Professional Documents
Culture Documents
Ann 3 INPUT AND OUTPUT
Ann 3 INPUT AND OUTPUT
input_data = [
[0, 0, 0, 0], # 0
[0, 0, 0, 1], # 1
[0, 0, 1, 0], # 2
[0, 0, 1, 1], # 3
[0, 1, 0, 0], # 4
[0, 1, 0, 1], # 5
[0, 1, 1, 0], # 6
[0, 1, 1, 1], # 7
[1, 0, 0, 0], # 8
[1, 0, 0, 1] # 9
output_labels = [
[1, 0] # odd
bias = np.random.uniform(size=(2,))
def sigmoid(x):
return 1 / (1 + np.exp(-x))
learning_rate = 0.1
epochs = 1000
for i in range(len(input_data)):
# Forward pass
output = sigmoid(z)
user_input = int(user_input)
else:
print("Predicted: Odd")
else:
print("Predicted: Even")