import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
np.random.seed(1)
weights = np.random.rand(3, 1)
inputs = np.array([[0, 0, 1],
[1, 1, 1],
[1, 0, 1],
[0, 1, 1]])
outputs = np.array([[0], [1], [1], [0]])
for _ in range(10000):
outputs_pred = sigmoid(np.dot(inputs, weights))
error = outputs - outputs_pred
adjustments = error * (outputs_pred * (1 - outputs_pred))
weights += np.dot(inputs.T, adjustments)
new_input = np.array([[1, 0, 0]])
print(sigmoid(np.dot(new_input, weights)))