Skip to content
DeepForgeby svx
All problems
EasyCalculusca-278

Softplus Derivative Vector

Problem

The softplus function f(z) = log(1 + exp(z)) has derivative sigmoid(z) = 1 / (1 + exp(-z)).

Return the derivative at each of the given values. Use a numerically stable sigmoid.

Hint

Softplus differentiates to the logistic function; branch to avoid overflow.

Test cases

case 1
in: [[0,1,-1]]
expected: [0.5,0.7310585786300049,0.2689414213699951]
case 2
in: [[10,-10]]
expected: [0.9999546021312976,0.000045397868702434395]
case 3
in: [[0.5,-0.5,2]]
expected: [0.6224593312018546,0.37754066879814546,0.8807970779778823]
Starter codePython
def softplus_derivative(values):
    # Your code here
    pass

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