# Logistic Regression

Find the probability of data samples belonging to a specific class with one of the most popular classification algorithms.

Start## Key Concepts

Review core concepts you need to learn to master this subject

Scikit-Learn *Logistic Regression* Implementation

*Logistic Regression* sigmoid function

*Classification Threshold* definition

*Logistic Regression* interpretability

*Log-Odds* calculation

Logistic Regression Classifier

*Logistic Regression* prediction

*Logistic Regression* cost function

Scikit-Learn *Logistic Regression* Implementation

Scikit-Learn *Logistic Regression* Implementation

*Scikit-Learn* has a *Logistic Regression* implementation that fits a model to a set of training data and can classify new or test data points into their respective classes. All important parameters can be specified, as the norm used in penalizations and the solver used in optimization.

- 1When an email lands in your inbox, how does your email service know whether it’s real or spam? This evaluation is made billions of times per day, and one possible method is logistic regression. _…
- 2With the data from Codecademy University, we want to predict whether each student will pass their final exam. Recall that in linear regression, we fit a line of the following form to the data: y =…
- 3We saw that predicted outcomes from a linear regression model range from negative to positive infinity. These predictions don’t really make sense for a classification problem. Step in _**logistic r…
- 5Let’s return to the logistic regression equation and demonstrate how this works by fitting a model in sklearn. The equation is: ln(\frac{p}{1-p}) = b_{0} + b_{1}x_{1} + b_{2}x_{2} +\cdots + b_{n}x…
- 6Now that we’ve learned a little bit about how logistic regression works, let’s fit a model using [sklearn](http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.h…
- 7Using a trained model, we can predict whether new datapoints belong to the positive class (the group labeled as 1) using the .predict() method. The input is a matrix of features and the output is a…
- 8As we’ve seen, logistic regression is used to predict the probability of group membership. Once we have this probability, we need to make a decision about what class a datapoint belongs to. This is…
- 9When we fit a machine learning model, we need some way to evaluate it. Often, we do this by splitting our data into training and test datasets. We use the training data to fit the model; then we us…
- 10Once we have a confusion matrix, there are a few different statistics we can use to summarize the four values in the matrix. These include accuracy, precision, recall, and F1 score. We won’t go int…

## What you'll create

Portfolio projects that showcase your new skills

## How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory