Output After Training: [[ 0.03178421] [ 0.02576499] [ 0.97906682] [ 0.97414645]]which shows output values for each input close to y.
k0=nonlin(np.array([1,2,1]).dot(syn0))
You can classify the new data one by one or all together.
import matplotlib.pyplot as pltand use the functions
plt.plot
and plt.show
to do the plotting.
For this part we will start from the code posted at https://iamtrask.github.io/2015/07/12/basic-python-network/ under 3 layer neural network.
epoch 0 Error: 0.496410031903 epoch 10000 Error: 0.00858452565325 epoch 20000 Error: 0.00578945986251 epoch 30000 Error: 0.00462917677677 epoch 40000 Error: 0.00395876528027 epoch 50000 Error: 0.00351012256786 Output After Training: [[ 0.00260572] [ 0.99672209] [ 0.99701711] [ 0.00386759]]which showns the network on the given inputs produces output values close to y.
X= np.array([[0,0,1],[0,1,1],[1,0,1],[1,1,1],[0,0,0],[1,1,0],[0,1,0],[1,0,0]]) Y= np.array([[0],[1],[1],[0],[0],[1],[1],[0]])and run the program again with 4 hidden nodes as in the original program. Print the output after training.
X = np.array([[1,1,1],[1,2,1],[2,2,1],[2,3,1],[2,1,1],[3,2,1],[4,1,1],[4,2,1]]) y = np.array([[0],[0],[0],[0],[1],[1],[1],[1]])and a network with 2 hidden nodes. Run the program for 10,000 epochs and print the output after training and the weigths in both layers after training.