Python illustration of Neural net from scratch
Only Numpy !
git clone https://github.com/MarvinMartin24/Fully-Connected-Neural-Network.git
Go to your file directory, and run this command :
python3 main.py
net = Network()
net.add(FCLayer(input_size, nb_neurone))
net.add(ActivationLayer(activation, activation_prime))
net.add(FCLayer(prev_nb_neurone, output_size))
net.add(ActivationLayer(activation, activation_prime))
net.use(Loss, Loss_prime)
net.fit(x_train, y_train, Epoch, learning_rate)
out = net.predict(x_train)
print(out)
A | B | XOR |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
x_train = np.array([[[0,0]], [[0,1]], [[1,0]], [[1,1]]])
y_train = np.array([[[0]], [[1]], [[1]], [[0]]])
Output / Prediction :
Input =
[[[0 0]]
[[0 1]]
[[1 0]]
[[1 1]]]
Prediction =
[[[0.]]
[[1.]]
[[1.]]
[[0.]]]
This code is based on this Medium
Omar Aflak (Author of the Medium Article)
and Marvin Martin