Perceptron
المُدرِك (البرسيبترون)
Definition
The simplest neural network: a single unit that sums its weighted inputs and applies a threshold to give a binary output.
Definition
The perceptron is the simplest neural unit: it computes a weighted sum of inputs and applies a threshold to output a binary decision, trained by an error-correcting rule.
Practical examples
import numpy as np
X = np.array([[0,0],[0,1],[1,0],[1,1]])
y = np.array([0,0,0,1])
w, b = np.zeros(2), 0.0
for _ in range(10):
for x, t in zip(X, y):
p = int(w @ x + b > 0)
w += (t - p) * x
b += (t - p)
print([int(w @ x + b > 0) for x in X])Expected output
[0, 0, 0, 1]
