cd /news/neural-networks/i-built-a-neural-network-s-first-neu… · home topics neural-networks article
[ARTICLE · art-26583] src=dev.to ↗ pub= topic=neural-networks verified=true sentiment=↑ positive

I Built a Neural Network's First Neuron From Scratch — the 1958 Perceptron

A developer built Frank Rosenblatt's 1958 Perceptron from scratch, implementing a single neuron with weighted inputs, bias, and step activation. The project demonstrates how a perceptron learns a linear decision boundary through iterative weight updates, achieving perfect accuracy on linearly separable data. The developer notes the perceptron's limitation with non-linear problems like XOR, which led to the development of multi-layer networks and backpropagation.

read2 min publishedJun 13, 2026

Before transformers, before backprop, there was one neuron — Frank Rosenblatt's 1958 Perceptron. Build it and you understand the atom that every deep network is made of.

This is Day 1 of DeepLearningFromZero: neural nets built from a single neuron up, no framework magic.

Take inputs, multiply each by a weight, add a bias, then apply an activation. The original used a step: output +1 if the sum is ≥ 0, else −1.

let w = [Math.random(), Math.random()], b = 0;
const sum = x => w[0]*x[0] + w[1]*x[1] + b;
const predict = x => sum(x) >= 0 ? 1 : -1;

w₁·x₁ + w₂·x₂ + b = 0

is the equation of a straight line — the decision boundary. One side is class +1, the other is −1. So a neuron's entire "knowledge" is the tilt and position of one line.

Predict each point. If correct, do nothing. If wrong, nudge the weights toward the right answer:

for (const { x, y } of data) {
  if (predict(x) !== y) {        // y is the true label, +1 or -1
    w[0] += lr * y * x[0];
    w[1] += lr * y * x[1];
    b    += lr * y;
  }
}

Geometrically, that rotates and shifts the line so the misclassified point ends up on the correct side. Repeat for a few epochs:

for (let epoch = 0; epoch < 50; epoch++) trainStep(0.1);

Rosenblatt proved it: if the two classes can be separated by a straight line, the perceptron will find one in a finite number of steps. Watch the accuracy climb to 100% and training stop.

A single neuron can only draw one straight line. The famous failure is XOR — no single line separates it. That limitation nearly killed neural nets in the 1970s.

The fix: stack neurons into layers, swap the step for a smooth activation, and train with gradient descent + backprop. That arc — from this one neuron to a transformer — is the rest of the series.

🌐 Train the neuron live (watch the boundary rotate): https://dev48v.infy.uk/dl/day1-perceptron.html

Day 1 of DeepLearningFromZero. From one neuron to transformers, built from scratch.

── more in #neural-networks 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-built-a-neural-net…] indexed:0 read:2min 2026-06-13 ·