Find a course

Module 2: Inside Machine LearningLesson 4 of 1113 min

Neural Networks Made Simple

Explore a single artificial neuron that weighs inputs and makes a decision, then see how layers of neurons form the deep networks behind modern AI.

Step 1 of 11Learn

One artificial neuron

The AI behind face recognition, translation and chatbots is built from neural networks, which are loosely inspired by brain cells. But don't picture a digital brain. An artificial neuron is a tiny piece of arithmetic.

A neuron takes several inputs (numbers), multiplies each by a weight, adds them up along with a bias, and then decides how strongly to "fire."

Example: should you go to the beach today? Suppose the inputs are:

  • sunny (1 for yes, 0 for no), weight 3
  • temperature in tens of degrees Celsius (for example 2.5 for 25 °C), weight 2
  • homework due tomorrow (1 or 0), weight −4

and the bias is −6. On a sunny 25-degree day with no homework:

(1 × 3) + (2.5 × 2) + (0 × −4) − 6 = 3 + 5 + 0 − 6 = 2

A positive total means "yes, go." With homework due, the total becomes 2 − 4 = −2: stay home.

The weights encode what matters and how much. The big negative weight on homework says it's a strong reason not to go. Training a neural network means adjusting these weights (and biases) until the network's outputs match the labels in the training data. Nobody types the weights in by hand; the training loop finds them.

Step 2 of 11Try the calculator

The beach neuron

Weights from the example: sunny 3, temperature 2, homework −4, bias −6. A positive total means go to the beach.

Weighted total
2
Decision (1 go, 0 stay)
1

Step 3 of 11Practice · Work it out

A neuron has inputs 2 and 1, with weights 3 and −1, and a bias of −2. What is its total before any activation function is applied?

Step 4 of 11Learn

Activation, a soft yes or no

After adding up its weighted inputs, a neuron passes the total through an activation function, which turns it into the neuron's output.

A simple choice is a step: output 1 if the total is above 0, otherwise 0. That gives a hard yes or no.

Many networks instead use smooth functions. A classic one is the sigmoid, which squashes any number into the range 0 to 1:

  • very negative totals give outputs near 0 (a confident no)
  • a total of 0 gives exactly 0.5 (unsure)
  • very positive totals give outputs near 1 (a confident yes)

That makes the output easy to read as a kind of confidence: 0.92 means "fairly sure yes." Smooth functions also make training possible, because a small change to a weight causes a small change in the output, so the training loop can tell which direction improves things.

Modern networks often use other activation functions, such as one that simply outputs the total if it's positive and 0 otherwise, because it's fast to compute and trains well in very deep networks. The idea is the same: weighted sum in, activation out.

Try the explorer below. The curve is a sigmoid neuron's output as one input changes. Adjust the weight and bias and watch how the decision shifts.

Step 5 of 11Explore

Single neuron explorer

The curve shows a sigmoid neuron's output (from 0 to 1) as its input x changes. A larger weight makes the decision sharper; the bias shifts where the neuron switches from no to yes.

00.20.40.60.81 -10-50510
Output for the chosen input
0.953
Input where output is exactly 0.5
2

Step 6 of 11Learn

Layers make networks deep

One neuron can only make simple decisions. The power comes from connecting many neurons in layers:

  • The input layer receives the raw data, such as the brightness of every pixel in an image.
  • One or more hidden layers in the middle combine the inputs in increasingly complex ways.
  • The output layer gives the answer, such as a confidence score for "cat," "dog" and "bird."

Each neuron in one layer sends its output to neurons in the next. In an image network, early layers often end up detecting simple features like edges and color patches. Middle layers combine edges into shapes such as circles, corners and textures. Later layers combine shapes into parts like eyes, ears and wheels, and the output layer decides what the whole image shows. Nobody programs these features; they emerge as training adjusts the weights.

A network with many hidden layers is called a deep neural network, which is where the term deep learning comes from. Large modern models have billions of weights.

One honest limitation: because the knowledge is spread across millions or billions of weights, it's very hard to explain exactly why a big network made a particular decision. Researchers are working on ways to interpret networks, but for now many are partly a "black box," which matters when AI is used for serious decisions.

Step 7 of 11Flashcards

Neural network vocabulary

Tap a card to flip it.

Step 8 of 11Practice · Put in order

Put these stages of an image-recognition neural network in order, from raw input to final answer.

Drag the items, or use the arrow buttons, to put them in order.

  1. Input layer receives the pixel values
  2. Later layers recognize parts like eyes and ears
  3. Early hidden layers detect edges and color patches
  4. Middle layers combine edges into shapes and textures
  5. Output layer gives a confidence score for each label

Step 9 of 11Note

Step 10 of 11Practice · Code challenge

Write neuron(inputs, weights, bias) that returns 1 if the weighted sum of the inputs plus the bias is greater than 0, and 0 otherwise (a step activation). inputs and weights are arrays of the same length.

Runs in a sandbox in your browser.
  • neuron([1, 2.5, 0], [3, 2, -4], -6)
  • neuron([1, 2.5, 1], [3, 2, -4], -6)
  • neuron([2, 1], [3, -1], -2)
  • neuron([0, 0], [5, 5], 0)

Step 11 of 11Practice · Choose one

What happens to a neural network's weights during training?