In this tutorial, we will learn logistic regression and how to implement it in machine learning projects.

Logistic regression can be used to predict a categorical dependent variable on the basis of continuous and/or categorical independents; to determine the effect size of the independent variables on the dependent; to rank the relative importance of independents; to assess interaction effects, and to understand the impact of covariate control variables. The impact of predictor variables is usually explained in terms of odds ratios.

Logistic regression applies maximum likelihood estimation after transforming the dependent into a logit variable. A logit is the natural log of the odds of the dependent equaling a certain value or not (usually 1 in binary logistic models, or the highest value in multinomial models). Logistic regression estimates the odds of a certain event (value) occurring. This means that logistic regression calculates changes in the log odds of the dependent, not changes in the dependent itself as OLS regression does.

**Logistic regression can also be used in:**

Healthcare to identify risk factors for diseases and plan preventive measures.

Weather forecasting apps to predict snowfall and weather conditions.

Voting apps to determine if voters will vote for a particular candidate.

And more which is related to discrete values

**S- curve to show logistic regression:**

Ref: https://en.wikipedia.org/wiki/Logistic_regression

**Logistic Regression Equation**

**When to use:**

It is used when we need to classify between two categories. Like he is like fruits or not like fruits, good or not good, etc.

**How to Implement it?**

**Import All related Libraries:**

from sklearn.linear_model import LogisticRegression import numpy as np import random

**Load data or import data **

Here we implement it through it titanic data sets:

**Fit it into the model:**

**Predict the result**

**Finding Score:**

#machinelearning #datascience #python