Foundations / Neurons & the Perceptron
Neurons & the Perceptron
BeginnerThe artificial neuron is the basic computational unit: a weighted sum of inputs passed through a non-linearity.
The artificial neuron
Each neuron receives inputs x, multiplies them by learnable weights w, adds a bias b and applies an activation function f.
Here d is the number of input features, w is the weight vector, b is the bias, and f is the activation function.
The perceptron (Rosenblatt, 1958)
The perceptron uses a step function as activation and can learn any linearly separable function. It famously cannot learn XOR, which motivated multi-layer networks.
For binary labels y ∈ {0, 1}, η > 0 is the learning rate. Update both weights and bias; the indicator is 1 when its condition holds and 0 otherwise.
Layers
- Input layer — receives raw features.
- Hidden layers — learn intermediate representations.
- Output layer — produces predictions (logits, probabilities, values).
- 'Deep' simply means many hidden layers.
Interview questions & answers
Q1. What do the weights, bias and activation do in an artificial neuron?
Answer: Weights control each input's contribution to a weighted sum. The bias shifts the decision boundary independently of the inputs. The activation transforms the result, usually introducing the non-linearity needed to model complex relationships.
Q2. Why can a single perceptron not learn XOR?
Answer: A single perceptron produces a linear decision boundary. XOR's positive and negative examples cannot be separated by one straight line, so it requires a model with non-linear features, such as a multi-layer network with non-linear activations.
Q3. When does the perceptron learning algorithm converge?
Answer: For a finite, linearly separable training set, the standard perceptron algorithm with a positive learning rate converges to a separating boundary after finitely many mistakes. For non-separable data, convergence to zero training error is not guaranteed.