


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Machine Learning (CS 5350/CS 6350) 18 Jan 2006
We’ve talked about regressing on R... what about {− 1 , +1}? Consider our old example, augmented with some new features.
Length ≥ 155 Width ≥ 90 Cool Design Type 1 0 1 Ski 1 0 0 Ski 1 1 0 Ski 1 0 0 Ski 1 0 1 Ski 1 1 0 Ski 1 0 0 Ski 0 0 0 Ski 1 1 1 Snowboard 1 1 1 Snowboard 0 1 1 Snowboard 0 1 1 Snowboard 0 0 0 Snowboard 0 1 0 Snowboard 0 0 1 Snowboard 0 1 1 Snowboard
Idea: learn a predictor that is largely positive for one class and largely negative for another.
Sigmoid function:
σ(x) =
exp[x/2] exp[x/2] + exp[−x/2]
=
1 + exp[−x]
Inverse is the logistic:
σ−^1 (y) = log
y 1 − y
Specify a probability distribution on y conditioned on x:
pθ (y | x) = σ(yθ>x) =
1 + exp[−yθ>x]
This is the logistic regression model.
No closed-form solution exists; compute log likelihood:
`(θ) = log
n
pθ (yn | xn)
n
log
1 + exp[−ynθ>xn]
= −
n
log
1 + exp[−ynθ>xn]
Now, compute the gradient.
∇θ ` = −
n
1 + exp[−ynθ>xn]
exp−ynθ>xn
n
1 + exp[ynθ>xn] ynxn
And we can do gradient descent.
This is a linear model because the output (±1) is a (thresholded) linear function of the input. For linear functions, we can draw the decision boundary as a linear function:
−4 −2 0 2 4 6 8
−
−
−
−
0
2
4
Find set of x for which θ>x = 0 and this is the decision boundary, which will be linear.
For multiclass problems, replace logistic with soft-max. For each of the K classes, let θk,: be a weight vector. Then, set:
pθ (y | x) =
exp[θy >x] ∑ k exp[θk>x]
For a two class problem, this reduces to the logistic (with a small adjustment of parameters). Usually fix θ 0 ,: = 0 for identifiability.
Compute log-likelihood and gradient:
Exercise: verify that there exist parameters π, θ for the naive Bayes model that mimick the logistic regression behavior (and vice-versa).
Change of pace...
Making things work:
Doing good experiments: