Skip to content
DeepForgeby svx
All problems
MediumCalculusca-338

Softplus Second Derivative Vector

Problem

Softplus has first derivative sigmoid(z), so its second derivative is sigmoid(z) * (1 - sigmoid(z)).

Given the values z, return the second derivative list using a stable sigmoid.

Hint

The second derivative of softplus is the derivative of the sigmoid.

Test cases

case 1
in: [[0,1,-1]]
expected: [0.25,0.19661193324148185,0.19661193324148185]
case 2
in: [[5,-5]]
expected: [0.006648056670790033,0.0066480566707901555]
case 3
in: [[2,-2]]
expected: [0.10499358540350662,0.1049935854035065]
Starter codePython
def softplus_second_derivative(values):
    # Your code here
    pass

3 test cases · run your code against them in the editor