项目作者: MarvinMartin24

项目描述 :
Python illustration of Neural net from scratch
高级语言: Python
项目地址: git://github.com/MarvinMartin24/Fully-Connected-Neural-Network.git
创建时间: 2020-01-11T16:44:46Z
项目社区:https://github.com/MarvinMartin24/Fully-Connected-Neural-Network

开源协议:MIT License

下载


Fully Connected Neural Network

Requirements

Only Numpy !

RUN

  1. git clone https://github.com/MarvinMartin24/Fully-Connected-Neural-Network.git

Go to your file directory, and run this command :

  1. python3 main.py

Usage

  1. net = Network()
  2. net.add(FCLayer(input_size, nb_neurone))
  3. net.add(ActivationLayer(activation, activation_prime))
  4. net.add(FCLayer(prev_nb_neurone, output_size))
  5. net.add(ActivationLayer(activation, activation_prime))
  6. net.use(Loss, Loss_prime)
  7. net.fit(x_train, y_train, Epoch, learning_rate)
  8. out = net.predict(x_train)
  9. print(out)

Implementation : XOR

  • Input / Data:
A B XOR
0 0 0
0 1 1
1 0 1
1 1 0
  1. x_train = np.array([[[0,0]], [[0,1]], [[1,0]], [[1,1]]])
  2. y_train = np.array([[[0]], [[1]], [[1]], [[0]]])
  • Output / Prediction :

    1. Input =
    2. [[[0 0]]
    3. [[0 1]]
    4. [[1 0]]
    5. [[1 1]]]
    6. Prediction =
    7. [[[0.]]
    8. [[1.]]
    9. [[1.]]
    10. [[0.]]]

    Understand the Maths

    This code is based on this Medium

Colaborators

Omar Aflak (Author of the Medium Article)
and Marvin Martin