Back to questions
JuniorTheoryCommon
What does this program print?
import numpy as np
w, b = 2.0, -3.0
x = np.array([1.5, 3.0])
z = w * x + b
p = 1 / (1 + np.exp(-z))
print(round(p[0], 2), round(p[1], 2))0.5 0.95
- Expecting
0.0for a score of zero: the sigmoid of0is1 / (1 + 1) = 0.5, the point where the model sees both classes as equally likely. - Expecting
0.05for a score of3: withnp.exp(-z)in the denominator a positive score gives a probability above 0.5;0.05would neednp.exp(z).
- Which value of
xgives a probability of exactly 0.5 whenw = 2.0andb = -3.0? - Why can the output of the sigmoid be read as a probability for any score?