3.1- Multiple Neurons — Vector and Matrix Form
Suppose we have 2 neurons and 3 inputs.
Each neuron receives the same inputs, but has its own weights and bias.
| Neuron 1 | Neuron 2 |
|---|
| y1=w11x1+w12x2+w13x3+b1 | y2=w21x1+w22x2+w23x3+b2 |
Put the two outputs together:
[y1y2]=[w11x1+w12x2+w13x3+b1w21x1+w22x2+w23x3+b2]
Collect all the weights into a matrix:
W=[w11w21w12w22w13w23]
Inputs:
x=x1x2x3
Biases:
b=[b1b2]
Expanded:
[y1y2]=[w11w21w12w22w13w23]x1x2x3+[b1b2]
Example
Suppose we have 2 neurons and 3 inputs.
| weight 1 | weight 2 | weight 3 | bias |
|---|
| Neuron 1 | 1 | 2 | 3 | 1 |
| Neuron 2 | 2 | 1 | 2 | 2 |
Neuron 1
| Neuron | Neuron 1 | |
|---|
| 1 | y1=w11x1+w12x2+w13x3+b1 | y2=w21x1+w22x2+w23x3+b2 |
| 2 | y1=(1)(2)+(2)(3)+(3)(4)+1 | y2=(2)(2)+(1)(3)+(2)(4)+2 |
| 3 | y1=21 | y2=17 |
| Therefore: | | |
y=[21 and 17]