Skip to content
AI360XpertBeta

Artificial Neuron

A neuron is a tiny vote counter. It weights each input, adds a small nudge, and passes the total through a bend to decide what to output.

Inputs 1.0 and 0.5 times weights 0.8 and minus 0.6 sum to 0.5, plus bias 0.1 gives z 0.6, and a sigmoid turns it into output 0.65
Inputs 1.0 and 0.5 times weights 0.8 and minus 0.6 sum to 0.5, plus bias 0.1 gives z 0.6, and a sigmoid turns it into output 0.65

Why Does This Exist?

Your model gets numbers, not opinions. A pixel brightness, a word count, a sensor reading. Something has to turn that row of numbers into one call: keep or flag, yes or no, how much.

Without that unit you would hand-write the rule for every input combo. That breaks the moment inputs interact, because a strong signal in one column can cancel a weak one in another and no fixed cutoff sees it. Give each input its own volume knob instead, add the results, and you have a unit that can learn the rule from examples. Stacks of these units run modern nets.

This page covers the single unit: the weighted sum, the bias nudge, and the bend after it. The bends get their own page in activation functions. Stacks get theirs in multi-layer perceptron. How the knobs get learned lives in gradient descent. One idea you need first: a weighted sum, the same move linear regression uses to mix inputs. Here you add a bias and a bend after the mix.

Think of It Like This

The market stall owner at dawn

You run a fruit stall and each morning you decide whether to set up outside. You check three things: foot traffic yesterday, cloud cover now, and whether it is a weekend. You do not treat them equally. Foot traffic counts a lot, clouds count against, weekend counts a little for.

You score each one in your head, add the scores, then add your own pressure: rent is due, so an average day still gets you out there. That pressure is the bias. Then comes the bend. Below some total you stay in and save the fee. Above it you go out. A near miss and a sure thing both lead to the same open sign.

Where it stops: you can change your mind, feel tired, or break your own rule for a friend. A neuron cannot. It runs the same sum and the same bend every time, it keeps no memory, and it never asks whether opening was worth it. Learning the weights is a separate job for training, not something the unit does by itself.

How It Actually Works

A neuron takes a short list of numbers and returns one number. Call the inputs x1,x2x_1, x_2, plain readings like 1.0 and 0.5. Call the weights w1,w2w_1, w_2, one volume knob per input. Call the bias bb, a single nudge added at the end. The pre-activation total is zz, and the final output is yy after the bend.

The two steps

First comes the weighted sum. Multiply each input by its weight, add them, then add the bias:

z=w1x1+w2x2+bz = w_1 x_1 + w_2 x_2 + b

Weights set direction and strength. A positive weight says more input means more output. A negative weight says more input pushes output down. The bias slides the whole decision point. With zero bias the boundary must pass through the origin. With a bias it can sit wherever the data needs it.

Then comes the activation. Pass zz through a bend ff, so y=f(z)y = f(z). The classic bend here is the sigmoid, f(z)=1/(1+e−z)f(z) = 1 / (1 + e^{-z}), which squeezes any total into the range 0 to 1. You will meet the full menu of bends in activation functions. The perceptron used a hard step instead: 1 when zz reaches 0, else 0. Keep the split clear. The sum mixes. The bend decides the shape.

Worked example

Take two inputs, two weights, and one bias:

x1=1.0,x2=0.5,w1=0.8,w2=−0.6,b=0.1x_1 = 1.0, \quad x_2 = 0.5, \quad w_1 = 0.8, \quad w_2 = -0.6, \quad b = 0.1

Multiply first:

w1x1=0.8×1.0=0.80w_1 x_1 = 0.8 \times 1.0 = 0.80

Multiply second:

w2x2=−0.6×0.5=−0.30w_2 x_2 = -0.6 \times 0.5 = -0.30

Add the products:

0.80+(−0.30)=0.500.80 + (-0.30) = 0.50

Add the bias to get zz:

z=0.50+0.10=0.60z = 0.50 + 0.10 = 0.60

Push z=0.60z = 0.60 through a sigmoid. First the exponential term:

e−0.60≈0.5488e^{-0.60} \approx 0.5488

Then the output:

y=11+0.5488=11.5488≈0.6457y = \frac{1}{1 + 0.5488} = \frac{1}{1.5488} \approx 0.6457

Rounded, y≈0.65y \approx 0.65. Since 0.650.65 sits above 0.50.5, a step rule would fire with a 1, and a ReLU would pass through 0.600.60. The diagram above draws these same numbers: 1.0 and 0.5 on the left, 0.80 and minus 0.30 on the edges, 0.60 in the middle, 0.65 on the way out.

Code

The point is the check: the same products, the same sum, the same bend, printed for real.

import math

def neuron(x1: float, x2: float) -> tuple[float, float]:    w1: float = 0.8    w2: float = -0.6    b: float = 0.1    z: float = w1 * x1 + w2 * x2 + b    y: float = 1.0 / (1.0 + math.exp(-z))    return z, y

z, y = neuron(1.0, 0.5)print(f"z {z:.2f} y {y:.4f}")  # -> z 0.60 y 0.6457print(f"fires {y > 0.5}")  # -> fires True

The printout matches the hand computation: zz is 0.600.60, yy is 0.64570.6457, and the unit fires because 0.64570.6457 clears 0.50.5.

Watch Out For

Dropping the bias pins the boundary through the origin

It is tempting to skip bb and keep the formula short. Do that and the decision line must pass through zero no matter what the weights learn, so a cluster sitting fully on one side stays unseparable.

Symptom: training stalls with the line stuck at the wrong angle, or worked totals look right yet the cutoff fires on the wrong rows. Fix: keep bb as a trained number like any weight, or feed a constant input of 1.0 with its own weight when your setup has no bias term.

Stacking neurons with no bend stays linear

Two linear mixes in a row collapse into one linear mix. If every unit skips its activation, a whole stack can only draw straight boundaries, and depth buys nothing.

Symptom: adding layers does not fix errors on curved data, and hidden values grow or shrink without forming new shapes. Fix: keep a nonlinear bend after each sum, and check the bend page in activation functions before blaming the optimizer in gradient descent.

The Quick Version

  • An artificial neuron forms zz from inputs 1.0 and 0.5 as 0.8 times 1.0 plus minus 0.6 times 0.5 plus bias 0.1, which gives z=0.6z = 0.6.
  • A sigmoid turns z=0.6z = 0.6 into about 0.650.65, so the same unit can feed a soft score or a hard yes when the score clears 0.5.
  • Weights set how much each input counts and in which direction, while the bias slides the decision point away from zero.
  • Without a bend after the sum, stacked neurons collapse into one straight rule and cannot learn curves.
  • One neuron draws one boundary. Curves, regions, and stacked decisions need many neurons wired in layers.