This commit is contained in:
ritchie46 2019-09-07 14:45:59 +02:00
parent b0306e3231
commit 2abe1dc891
5 changed files with 0 additions and 46 deletions

View File

View File

@ -1,46 +0,0 @@
import numpy as np
"""
# Logistic Regression
w^T · x = w0 + w1x1 + w2x2 + w3x3
P(A|x) = σ(w^Tx)
# Given data:
D = ((x1, y1), ..., (xn, yn))
x R
y {0, 1}
# Pro's:
- interpretable
- small # params (d + 1)
- computationally efficient
- extensible to multi-class
# Cons
- performance as good as other models
# Maximum Likelihood Estimation MLE
labels y
input x
likelihood lw = P(y[i]| x[i], w) * P(y[j] | x[j], w) ... P(y[n] | x[n],w)
in product notation
lw =
"""
def sigmoid(z):
"""
:param z: w^Tx (scalar)
:return: σ(w^Tx) (scalar)
"""
return 1 / (1 + np.exp(-z))