# Perceptron

> Canonical: https://skillalmanac.com/glossary/perceptron | Last verified: 2026-11-24 | Index status: index-eligible

A perceptron is a simple algorithm that decides between two classes by multiplying each input by a learned weight, adding the results and applying a threshold. It is the basic building block of early neural networks.

Also called: perceptrons, single-layer perceptron, perceptron algorithm, perceptron model, what is a perceptron.

## In plain language

A perceptron is one of the simplest learning programs. It looks at a few numbers, such as features of an email, gives each number a weight showing how much it matters, adds them up and answers yes or no. During training it nudges the weights whenever it gets an example wrong. Think of a scale where you adjust the importance of each ingredient until the verdict matches the examples. The limit is that a single perceptron can only separate classes with a straight dividing line, so it cannot represent XOR in the original two binary input features. A nonlinear feature transformation changes that representation. Its weighted-input calculation also helps explain the units used in larger networks.

## Technical definition

A binary perceptron uses an affine score and a threshold. A common update changes weights after a misclassified example, using its features, label and a step size. The standard convergence result assumes separable data and its specified update procedure; it is not a guarantee for nonseparable problems or arbitrary stopping rules. A multilayer perceptron is a different architecture.

## How it shows up when you use agents

An agent can help you study a perceptron as a small example of learning from data: weighted inputs, an output, and a rule that changes the weights after each mistake. The same idea repeats, in far larger form, in the layers of a [neural network](/glossary/neural-network).

If you ask a coding agent to write one, the exercise is useful and quick. Ask for a perceptron on a tiny table, run it and read the weights. Then compare XOR in its original two features with a representation containing their product. The change tests the importance of the supplied features; reaching a maximum iteration count is not proof of convergence.

What breaks when it is misunderstood: people assume any perceptron-based model is limited to straight lines. A single affine decision boundary is linear in the features supplied to it. Stacked layers with a nonlinear [activation function](/glossary/activation-function) are not, which is why modern networks can learn curved boundaries. The step size of the weight updates is the [learning rate](/glossary/learning-rate), a setting you choose. Check any score on held-out data, not on the rows the model trained on.

## Worked example (illustrative)

For binary inputs x₁,x₂, add the feature x₁x₂ and choose the score x₁+x₂−2x₁x₂−0.5. Predict 1 for a positive score and 0 otherwise. The four inputs (0,0),(1,0),(0,1),(1,1) return 0,1,1,0: XOR. This hand-specified linear rule in transformed features does not make XOR linearly separable in its original two features, and no perceptron was trained here.

## Common confusions

- **Perceptron versus neural network.** A single perceptron is a simple linear classifier. Neural networks may have one or many layers and different connection patterns. See [Neural network](/glossary/neural-network).
- **Perceptron versus multilayer perceptron.** The multilayer version has several layers of units and can handle problems a single layer cannot. IBM mentions multilayer perceptrons only briefly, as a foundation for later network types.
- **Perceptron versus modern unit.** The classic perceptron uses a hard step output. Other units use activations such as smooth sigmoid or tanh and nonsmooth ReLU, which CS231n describes as stand-ins for a neuron's firing rate.
- **Myth.** The perceptron is only a historical curiosity. IBM calls it the historical ancestor of today's networks, and its weighted-sum idea still appears in them.

## Worked examples in this catalogue

### [split-leakage-check](https://skillalmanac.com/skills/skill-almanac/split-leakage-check)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A check of train, validation and test files for duplicates, shared groups, time and label leakage, printed as JSON.

Why it exercises the concept: This linked skill checks data-split contamination rather than training a perceptron. Clean splits are one requirement for a meaningful held-out evaluation.

### [mock-record-generator](https://skillalmanac.com/skills/skill-almanac/mock-record-generator)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Seeded mock records as CSV or JSON, generated from a JSON field list or a simple TypeScript interface.

Why it exercises the concept: Not a training skill. A perceptron needs rows of numbers to learn from, and seeded mock records give you a repeatable toy table to try one on. Real labels would have to come from your own data.

### [data-analysis-eda](https://skillalmanac.com/skills/skill-almanac/data-analysis-eda)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A fixed exploratory-analysis procedure and CSV profiler that keeps findings descriptive, evidenced and caveated.

Why it exercises the concept: Profiling can reveal missing values, feature types and class balance before fitting a classifier. It does not prove separability or predict how well a perceptron will generalize.

### [Claude Code](https://skillalmanac.com/tools/claude-code)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Claude Code's overview page describes it as an agentic coding tool that reads your codebase, edits files and runs commands.

Why it exercises the concept: A perceptron is short enough to write in a few lines. You can ask a coding agent to write one and run it on a toy table, then check the weights it learned yourself.

## Related terms

- [Neural network](https://skillalmanac.com/glossary/neural-network.md)
- [Supervised learning](https://skillalmanac.com/glossary/supervised-learning.md)
- [Activation function](https://skillalmanac.com/glossary/activation-function.md)
- [Learning rate](https://skillalmanac.com/glossary/learning-rate.md)
- [Machine learning (ML)](https://skillalmanac.com/glossary/machine-learning.md)
- [Deep learning](https://skillalmanac.com/glossary/deep-learning.md)

## Sources

- [What is a neural network?](https://www.ibm.com/think/topics/neural-networks), IBM (accessed 2026-11-24)
- [CS231n Convolutional Neural Networks for Visual Recognition: Neural Networks Part 1](https://cs231n.github.io/neural-networks-1/), Stanford University (accessed 2026-11-24)
- [Understanding Machine Learning, section 9.1.2: Perceptron for Halfspaces](https://www.cs.huji.ac.il/~shais/UnderstandingMachineLearning), Shalev-Shwartz and Ben-David (accessed 2026-11-24)
- [Polynomial features and the XOR perceptron example](https://scikit-learn.org/stable/modules/linear_model.html#polynomial-regression-extending-linear-models-with-basis-functions), scikit-learn (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-24. [Glossary index](https://skillalmanac.com/glossary.md).
