📘
Sigmoid Gradient
EasyDeep Learning
Problem Statement
Compute the derivative of the Sigmoid function given the activation output.
Background
The Sigmoid function is defined as: σ(z)=1+e−z1
A useful property is that its derivative can be computed directly from the output:
- If g=σ(z), then the derivative g′(z)=g×(1−g)
This makes backpropagation efficient since we already have the sigmoid output from the forward pass.
Your Task
Write a function sigmoid_derivative(sigmoid_output) that returns the gradient values for each element.
Output Format
Return a list of floats representing the derivatives. Round each value to 4 decimal places.
Example:
Input:
sigmoid_output=[0.5, 0.8]
Output:
[0.25, 0.16]
Reasoning:
For 0.5: 0.5 × (1 - 0.5) = 0.5×0.5 = 0.25. For 0.8: 0.8 × (1 - 0.8) = 0.8×0.2 = 0.16.
Constraints:
- 0 <= sigmoid_output[i] <= 1 for each element
- List length: 1 to 100 elements
Editor
Python 3.13.1
Test Results
0/0Run code to see test results.