CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Artificial Intelligence / How a Neural Network Thinks

A Neuron Is a Weighted Vote

Lesson 7 of 10 · 7 min · Free, no account needed

What you will learn

  • A neuron adds up its inputs, each times its weight, and fires when the sum reaches the threshold.
  • A big weight counts a lot. A negative weight votes against.
  • Moving the threshold is the same as adding a bias: it sets how easy it is to fire.
  • On a map of the inputs, one neuron draws one straight line.

Start the lesson

How the lesson goes

  1. Your brain has about 86 billion neurons. Watch one decide.

    Switch A pours water into the cup. Switch B has a weight of -1. Where will the water be when B turns on? Drag the marker, then Check.

  2. Turn up the weight of A until the lamp lights.

    Only A is on. Its wire gets thicker as its weight grows. Light the lamp, then Check.

  3. Go to the party only if a friend goes AND your homework is done.

    Both weights are 1. Drag the threshold line on the cup until the table matches the goal, then Check.

  4. Meet the building block of every neural network.

    Tap to reveal.

    This is a neuron: it adds its inputs and fires when the sum reaches the threshold.

    Each input counts times its weight. The sum of input times weight is the weighted sum.

    Moving the threshold is the same as adding a bias to the sum. Training tunes the weights and the bias.

  5. Rule challenge: 4 rules, one neuron each.

    Turn the weights and the threshold until every lamp matches the goal. Then go to the next rule.

  6. Be the neuron. Weight of A is 2, weight of B is -1, threshold 0.5.

    For each row, call it before the cup fills: will the lamp light?

  7. Your AND neuron draws a line.

    On the map, A goes across and B goes up. Drag the threshold until only the corner (1, 1) lights, then Check.

  8. Computer chips are built from logic gates. Your neurons already are some.

    Drag each gate onto the neuron whose lamp column matches it, then Check.

  9. Build a NOR gate: the lamp lights only when both inputs are off.

    Turn both weights and the threshold until the table matches, then Check.

  10. Your neurons run a week.

    Your OR and A-but-not-B neurons from the challenge decide each day. Press Run the week.

Previous lesson: The Learning Loop · Next lesson: Networks Solve XOR · Part of the course: How a Neural Network Thinks

Lessons are interactive and need JavaScript. Turn it on to play them.

Loading TwiddleLab