Lesson 1 · Deep Learning
Neurons & Perceptrons
7 min
You'll be able to
- Describe the anatomy of an artificial neuron
- Explain weights and biases
- Understand the perceptron decision
An artificial neuron is a tiny computation: multiply each input by a weight, sum them, add a bias, then push the result through an activation function. Weights express how important each input is; the bias shifts the decision.
A perceptron is the simplest neuron that makes a binary decision. It outputs one signal if the weighted sum passes a threshold, and another otherwise.
import numpy as np
def neuron(x, w, b):
z = np.dot(x, w) + b # weighted sum
return 1.0 if z > 0 else 0.0 # step activation
# two inputs: is it warm AND has a leash?
x = np.array([1, 1]); w = np.array([0.8, 0.7]); b = -1.0
print(neuron(x, w, b)) # decisionChallenge
Tune a decision
Using the neuron above, pick w and b so that it activates only when both inputs are 1 (an AND gate).
Knowledge Check
Neurons
What role does the bias play in a neuron?
Weights express how important each input is to the neuron's decision.
Answer all questions to submit.