Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to calculate the error between predicted and actual output.
ML Python
error = predicted - [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using predicted instead of actual causes zero error.
Using weights or bias here is incorrect.
✗ Incorrect
The error is the difference between the predicted value and the actual value.
2fill in blank
mediumComplete the code to compute the gradient of the loss with respect to weights.
ML Python
gradient = error * [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using bias or learning rate instead of input.
Using output instead of input.
✗ Incorrect
The gradient is calculated by multiplying the error by the input to the neuron.
3fill in blank
hardFix the error in updating the weights using gradient descent.
ML Python
weights = weights - [1] * gradient Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using gradient alone causes too large updates.
Using error or input directly is incorrect.
✗ Incorrect
Weights are updated by subtracting the learning rate times the gradient.
4fill in blank
hardFill both blanks to calculate the derivative of the sigmoid activation function.
ML Python
sigmoid_derivative = [1] * (1 - [2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using input, weights, or bias instead of sigmoid output.
Using different variables in the two blanks.
✗ Incorrect
The derivative of sigmoid is sigmoid_output times (1 minus sigmoid_output).
5fill in blank
hardFill all three blanks to update bias using gradient descent.
ML Python
bias = bias - [1] * [2] * [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using input instead of 1 for bias update.
Forgetting to multiply by learning rate or error.
✗ Incorrect
Bias update uses learning rate times error times 1 (since bias input is always 1).