All problems
Sigmoid (Vector)
Problem
Apply the logistic sigmoid function element-wise to a list of values: σ(z) = 1 / (1 + exp(-z)).
Handle large positive and negative values without overflow.
Hint
Factor out the stable scalar sigmoid from ml-002.
Test cases
case 1
in: [[0,0,0]]
expected: [0.5,0.5,0.5]
case 2
in: [[100,-100,0]]
expected: [1,0,0.5]
case 3
in: [[1,2]]
expected: [0.7310585786300049,0.8807970779778823]
Starter codePython
import math
def sigmoid_vector(z):
# Your code here
pass3 test cases · run your code against them in the editor