Logistic Regression Introduction
Logistic Regression is a classification algorithm. It is used to predict a binary outcome (1 / 0, Yes / No, True / False) given a set of independent variables. To represent binary / categorical outcome, we use dummy variables. You can also think of logistic regression as a special case of linear regression when the outcome variable is categorical, where we are using log of odds as the dependent variable.
In simple words, it predicts the probability of occurrence of an event by fitting data to a logit function, read more about Logistic Regression .
LogisticRegression() function is part of linear_model module of sklearn and is used to create logistic regression
Reference: Mathematical working and implementation from scratch for Logistic regression.
This exercise is part of the course
Introduction to Python & Machine Learning (with Analytics Vidhya Hackathons)
Exercise instructions
- Import Linear model of sklearn
- Create object of sklearn.linear_model.LogisticRegression
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import linear model of sklearn
import ______.linear_model
# Create object of Logistic Regression
model=sklearn.______.LogisticRegression()