# Exemplo de um perceptron simples em Python
import numpy as np
def perceptron(X, y, epochs, learning_rate):
weights = np.zeros(X.shape[1])
for _ in range(epochs):
for i in range(len(X)):
prediction = np.dot(X[i], weights)
error = y[i] - prediction
weights += learning_rate * error * X[i]
return weights
# Dados de exemplo
X = np.array([[1, 2], [2, 3], [3, 4]])
y = np.array([0, 1, 1])
weights = perceptron(X, y, epochs=10, learning_rate=0.1)
print(weights)