Logistic Regression Logistic regression is used when the

  • Slides: 11
Download presentation
Logistic Regression • Logistic regression is used when the dependent variable is binary in

Logistic Regression • Logistic regression is used when the dependent variable is binary in nature. • In contrast, Linear regression is used when the dependent variable is continuous and nature of the regression line is linear • When the outcome variable is categorical in nature, logistic regression can be used to predict the likelihood of an outcome based on the input variables • Estimating probabilities using a logistic function • Logistic regression can be used to model and solve as binary classification problems.

Examples of binary classification problems • Spam Detection : Predicting if an email is

Examples of binary classification problems • Spam Detection : Predicting if an email is Spam or not • Credit Card Fraud : Predicting if a given credit card transaction is fraud or not • Health : Predicting if a given mass of tissue is benign or malignant • Marketing : Predicting if a given user will buy an insurance product or not • Banking : Predicting if a customer will default on a loan.

Logistic regression • Get a probability score that reflects the probability of the occurrence

Logistic regression • Get a probability score that reflects the probability of the occurrence of the event • An event in this case is each row of the training dataset. • It could be something like classifying if a given email is spam, or mass of cell is malignant or a user will buy a product and so on

> Logistic Regression Model Description n Logical regression is based on the logistic function

> Logistic Regression Model Description n Logical regression is based on the logistic function n As y -> infinity, f(y)->1; and as y->-infinity, f(y)->0

> Logistic Regression Model Description n With the range of f(y) as (0, 1),

> Logistic Regression Model Description n With the range of f(y) as (0, 1), the logistic function models the probability of an outcome occurring In contrast to linear regression, the values of y are not directly observed; only the values of f(y) in terms of success or failure are observed. Called log odds ratio, or logit of p. Maximum Likelihood Estimation (MLE) is used to estimate model parameters. MLR is beyond the scope of this book.

Odds n Odds are most simply calculated as the number of events divided by

Odds n Odds are most simply calculated as the number of events divided by the number of non-events.

Logit function

Logit function

Sigmoid Function • A sigmoid function is a type of activation function, and more

Sigmoid Function • A sigmoid function is a type of activation function, and more specifically defined as a squashing function. • Squashing functions limit the output to a range between 0 and 1, making these functions useful in the prediction of probabilities

R Code

R Code

 • http: //setosa. io/ev/ordinary-least-squares-regression/

• http: //setosa. io/ev/ordinary-least-squares-regression/