PIXELBANKv9.1.0
Menu

Problem Statement

Compute the derivative of the Sigmoid function given the activation output.

Background

The Sigmoid function is defined as: σ(z)=11+e−z\sigma(z) = \frac{1}{1 + e^{-z}}

A useful property is that its derivative can be computed directly from the output:

  • If g=σ(z)g = \sigma(z), then the derivative g′(z)=g×(1−g)g'(z) = g \times (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×05 \times 0.5 = 0.25. For 0.8: 0.8 × (1 - 0.8) = 0.8×08 \times 0.2 = 0.16.

Constraints:

  • 0 <= sigmoid_output[i] <= 1 for each element
  • List length: 1 to 100 elements
solution.py

Test Results

0/0
Run code to see test results.