Lecture 5
Lecture 5
Regression
Classification
Machine Learning
Logistic Regression is one of the most
widely used algorithms in the world
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Interpretation of Hypothesis Output
= estimated probability that y = 1 on input x
Example: If
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Andrew Ng
Logistic regression 1
z
Suppose predict “ “ if
predict “ “ if
Andrew Ng
Decision Boundary
x2
3
2
1 2 3 x1
Predict “ “ if
Andrew Ng
Non-linear decision boundaries
x2
-1 1 x1
-1
Predict “ “ if
x2
x1
Andrew Ng
Andrew Ng
Logistic
Regression
Hypothesis
Representation
Machine Learning
Training set:
m examples
“non-convex” “convex”
Andrew Ng
Logistic
Regression
Cost function and Likelihood
Function for Logistic
Regression
Machine Learning
Logistic regression cost function
To fit parameters :
Andrew Ng
Gradient Descent
Want :
Repeat
Andrew Ng
Logistic
Regression
Multi-class classification:
One-vs-all
Machine Learning
Multiclass classification
Andrew Ng
Binary classification: Multi-class classification:
x2 x2
x1 x1
Andrew Ng
x2
One-vs-all (one-vs-rest):
x1
x2 x2
x1 x1
x2
Class 1:
Class 2:
Class 3:
x1
Andrew Ng
Andrew Ng
One-vs-all
Andrew Ng