Single Neuron Forward Pass
Manually compute a single neuron's output, following the notes' own formula exactly: output = activation((input1 x weight1) + (input2 x weight2) + ... + bias).
Approach: compute the weighted sum of inputs and weights, add the bias, then apply ReLU as the activation function.
Input: Three lines: the inputs (space-separated), the weights (space-separated, same count as inputs), and the bias.
Output: One line: the neuron's output, rounded to 4 decimal places.
1 2 3 0.5 -0.5 1 0.1
2.6
- 1 <= number of inputs <= 10
Hint 1
zip(inputs, weights) pairs up each input with its matching weight.
Hint 2
sum(i * w for i, w in zip(inputs, weights)) computes the weighted sum in one line.
Hint 3
Add the bias, then apply ReLU (max(0, total)) as the activation — matching the notes' single-neuron formula exactly.
sum(i * w for i, w in zip(inputs, weights)) computes (input1 x weight1) + (input2 x weight2) + ... in one expression, matching the notes' formula term for term. Adding the bias and applying ReLU (max(0, total)) as the activation function reproduces exactly what a single neuron computes during a forward pass, entirely in plain Python.