print('[0, 1] -> {}'.format(nn.activate([0, 1]))) print('[1, 0] -> {}'.format(nn.activate([1, 0]))) print('[1, 1] -> {}'.format(nn.activate([1, 1]))) print() # 4.3 B. Delta Rule # Neural Network Settings learning_rate = 100 epochs = 1000 weight_lower_bound = -1 weight_upper_bound = 1 rng = np.random.RandomState(seed=None) nn = NeuralNetwork(3, [], [NeuronInfo(sigmoid, sigmoid_derivative)]) print('Training a NOR Gate:\n{}\n'.format(nn)) nn.randomize(rng, weight_lower_bound, weight_upper_bound) print('Training...') inputs = np.array([ [0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1], ]) expected_outputs = np.array([ [1], [0],