from NeuralNetwork import NeuralNetwork import numpy as np layout = [3, 2] def cap(x): return min(1, max(-1, x)) def sigmoid(x): return 1 / (1 + np.exp(x)) NN = NeuralNetwork(layout, sigmoid) data = [ [[0, 0, 0], [0, 0]], [[0, 0, 1], [0, 1]], [[0, 1, 0], [1, 0]], [[0, 1, 1], [1, 1]], [[1, 0, 0], [0, 0]], [[1, 0, 1], [0, 1]], [[1, 1, 0], [1, 0]], ] # NN.train(data) print(NN.toString()) print("") # print(NN.evaluate(data[0][0])) for i in range(10): print(NN.fit(data, (10-i) / 20)) print(NN.evaluate([1, 1, 1])) print(NN.toString())