Codiqo

Understanding AI · lesson 27 of 60 · about 5 minutes

Making a Decision

A total isn't an answer yet. See how a neuron turns its total into a yes or a no.

What you'll learn

  • Turn a total into a decision with a threshold
  • Predict a neuron's decision for given inputs
  • Explain why some neurons give a number between 0 and 1

Over the line?

The simplest neuron decides like this: if the total is more than 0, answer yes (1); otherwise answer no (0).

That last step is called the activation. It's what turns a pile of maths into a decision.

The park neuron decides. With a total of 4, it's a yes.

def decide(total):
    if total > 0:
        return 1
    return 0

print(decide(4))
print(decide(-2))

Output

1
0

Softer answers

Modern networks often use a smoother activation that gives a number between 0 and 1 instead of a hard yes or no. 0.9 means fairly sure yes; 0.5 means unsure. That smoothness makes training work much better.

Tip

Hard yes-or-no neurons are easy to follow; smooth ones are easier to train.

Now try it yourself

This lesson is free in Codiqo, with 6 questions on what you just read. You can only learn to code by writing code, so it ends with a short program you write yourself, which we run and check straight away.