Hello, everyone! Faced with trouble - you need to train the network on the attached dataset (above) and sample from the habr ( post itself ). The final result is nothing like the original set of values. What I could fix: I sin on a sigmoid, but I could miss something important from my attention in any other place. Thank you so much if you respond!
(Pre-deleted lines with question marks and placed the set in txt).
import numpy as np # sigmoid func def sigmoid(x, deriv=False): if deriv: # print(sigmoid(x) * (1 - sigmoid(x))) return sigmoid(x) * (1 - sigmoid(x)) return 1 / (1 + np.exp(-x)) # input initialization dataset = np.genfromtxt('dataset.txt', delimiter=',') X = dataset[..., 0:12] y = np.array([dataset[..., 13]]).T # input normalization Xn = X / X.max(axis=0) yn = y / y.max(axis=0) # random numbers initialization np.random.seed(1) syn0 = 2 * np.random.random((12, 1)) - 1 for i in range(50000): # direct error propagation l0 = Xn l1 = sigmoid(np.dot(l0, syn0)) # error computing l1_error = yn - l1 # multiply this by the slope of sigmoid # using values of l1 l1_delta = l1_error * sigmoid(l1, True) # - ! # weights update syn0 += np.dot(l0.T, l1_delta) # - ! print("Output data after training: ") print(l1) Actual result Required result: [[8.25305827e-28] ~0 [9.99999908e-01] ~0.5 [5.25318843e-04] ~0.25 [2.41309677e-22] ~0 [2.09811612e-28] ~0 [2.37186828e-34] ~0 [1.43044972e-07] ~0.75 [6.83698176e-30] ~0 ... ...