0% found this document useful (0 votes)
21 views

Lecture 5

1) Logistic regression is a widely used machine learning algorithm for classification problems. 2) It uses an exponential or sigmoid function to model the probabilities of the different classes to predict the probability that an input belongs to a particular class. 3) The logistic regression model is trained by minimizing a cost function using gradient descent to learn the parameters that best fit the training data.

Uploaded by

Usama Mustafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Lecture 5

1) Logistic regression is a widely used machine learning algorithm for classification problems. 2) It uses an exponential or sigmoid function to model the probabilities of the different classes to predict the probability that an input belongs to a particular class. 3) The logistic regression model is trained by minimizing a cost function using gradient descent to learn the parameters that best fit the training data.

Uploaded by

Usama Mustafa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 61

Logistic

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

Tell patient that 70% chance of tumor being malignant

“probability that y = 1, given x,


parameterized by ”

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

How to choose parameters ?


Andrew Ng
Cost function
Linear regression:

“non-convex” “convex”

Andrew Ng
Logistic
Regression
Cost function and Likelihood
Function for Logistic
Regression

Machine Learning
Logistic regression cost function

To fit parameters :

To make a prediction given new :


Output

Andrew Ng
Gradient Descent

Want :
Repeat

(simultaneously update all )

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

Train a logistic regression classifier for each


class to predict the probability that .

On a new input , to make a prediction, pick the


class that maximizes

Andrew Ng

You might also like