< prev | next >

Logistic Regression

Logistic regression is used to model the probability of a certain class or classes based on modeling data.

The term logistic refers to the logistic curve used as the basis for logistic regression analysis.

Prediction results are assigned a probability between 0 (lowest score) and 1 (highest score).

Logistic (s curve) functions are used, which have the shape:

SigmoidFunction.jpg

Mathematical Model

Key aspects of the model include:

Odds of Something Occurring

As example is the odds that a sports team will win a give game. See a detailed discussion of odds here.

Log-odds (logit) of Odds

This is the logarithm to a given base of odds. See a detailed discussion of odds here.

Logarithms

This is the inverse of exponentiation. See a detailed discussion of odds here.

Probabilities

This is the likelihood that an event will occur expressed in a range from 0 to 1. See a detailed discussion of odds here.

Python Example

To download the code below, click here.

"""
logistic_regression_with_scikit_learn.py
trains and uses a model to predict one of three classes for each input
"""

# Import needed libraries.
import random
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression

# Set parameters.
number_of_prediction_inputs = 100

# Load test data.
X, y = load_iris(return_X_y=True)
print("X - Data Features:")
print(X)
print("y - Data Classes:")
print(y)

# Instantiate a model.
model = LogisticRegression(random_state=0)

# Train the model.
estimator = model.fit(X, y)

# Get the training score (accuracy).
score = estimator.score(X, y)
print("Score:")
print(score)

# Create shuffled prediction input data.
shuffled_input_data = X
random.shuffle(shuffled_input_data)
print("Shuffled Input Data:")
print(shuffled_input_data)

# Get prediction input data from the shuffled training data.
prediction_input = shuffled_input_data[:number_of_prediction_inputs, :]
print("Prediction Input:")
print(prediction_input)

# Make predictions.
predicted_classes = estimator.predict(prediction_input)
print("Predicted Classes: ")
print(predicted_classes)

# Get prediction probabilities for each class.
probabilities = estimator.predict_proba(prediction_input)
print("Probabilities: ")
print(probabilities)
Output is below:

X - Data Features:
[[5.1 3.5 1.4 0.2]
 [4.9 3.  1.4 0.2]
 [4.7 3.2 1.3 0.2]
 [4.6 3.1 1.5 0.2]
 [5.  3.6 1.4 0.2]
 [5.4 3.9 1.7 0.4]
 [4.6 3.4 1.4 0.3]
 [5.  3.4 1.5 0.2]
 [4.4 2.9 1.4 0.2]
 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 [5.  3.4 1.6 0.4]
 [6.2 2.2 4.5 1.5]
 [5.1 3.5 1.4 0.2]
 [5.2 4.1 1.5 0.1]
 [5.1 3.8 1.6 0.2]
 [5.4 3.4 1.7 0.2]
 [4.4 3.  1.3 0.2]
 [6.1 2.8 4.  1.3]
 [5.  3.4 1.6 0.4]
 [5.2 3.4 1.4 0.2]
 [6.1 2.9 4.7 1.4]
 [5.8 4.  1.2 0.2]
 [6.  3.4 4.5 1.6]
 [6.4 2.9 4.3 1.3]
 [5.1 3.8 1.6 0.2]
 [5.8 4.  1.2 0.2]
 [5.7 2.8 4.5 1.3]
 [4.6 3.1 1.5 0.2]
 [5.1 3.3 1.7 0.5]
 [5.4 3.4 1.7 0.2]
 [5.1 3.5 1.4 0.3]
 [5.5 4.2 1.4 0.2]
 [5.4 3.  4.5 1.5]
 [6.2 2.2 4.5 1.5]
 [5.4 3.4 1.5 0.4]]
Predicted Classes:
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1
 0 0 1 0 0 0 0 0 1 0 0 1 0 2 1 0 0 1 0 0 0 0 0 2 1 0]
Probabilities:
[[8.79681649e-01 1.20307538e-01 1.08131372e-05]
 [8.79681649e-01 1.20307538e-01 1.08131372e-05]
 [8.53796795e-01 1.46177302e-01 2.59031285e-05]
 [8.53796795e-01 1.46177302e-01 2.59031285e-05]
 [8.53796795e-01 1.46177302e-01 2.59031285e-05]
 [8.79681649e-01 1.20307538e-01 1.08131372e-05]
 [8.53796795e-01 1.46177302e-01 2.59031285e-05]
 [8.97323628e-01 1.02665167e-01 1.12050036e-05]
 [7.99706325e-01 2.00263292e-01 3.03825365e-05]
 [8.25383127e-01 1.74558937e-01 5.79356669e-05]
 [8.61839691e-01 1.38141399e-01 1.89095833e-05]
 [9.26986574e-01 7.30004562e-02 1.29693872e-05]
 [8.95064974e-01 1.04895775e-01 3.92506205e-05]
 [7.88177618e-01 2.11794929e-01 2.74526810e-05]
 [7.88177618e-01 2.11794929e-01 2.74526810e-05]
 [8.61839691e-01 1.38141399e-01 1.89095833e-05]
 [9.40906153e-01 5.90890027e-02 4.84421830e-06]
 [7.99706325e-01 2.00263292e-01 3.03825365e-05]
 [8.25383127e-01 1.74558937e-01 5.79356669e-05]
 [8.95064974e-01 1.04895775e-01 3.92506205e-05]
 [9.40906153e-01 5.90890027e-02 4.84421830e-06]
 [9.21914602e-01 7.80675598e-02 1.78384021e-05]
 [7.88177618e-01 2.11794929e-01 2.74526810e-05]
 [8.92083069e-01 1.07910759e-01 6.17176870e-06]
 [9.64535656e-01 3.54620850e-02 2.25877936e-06]
 [9.28349898e-01 7.16491356e-02 9.66254924e-07]
 [9.26986574e-01 7.30004562e-02 1.29693872e-05]
 [9.26986574e-01 7.30004562e-02 1.29693872e-05]
 [8.60034106e-01 1.39955486e-01 1.04082979e-05]
 [9.28349898e-01 7.16491356e-02 9.66254924e-07]
 [7.88177618e-01 2.11794929e-01 2.74526810e-05]
 [8.92083069e-01 1.07910759e-01 6.17176870e-06]
 [8.53796795e-01 1.46177302e-01 2.59031285e-05]
 [9.26584671e-01 7.34068679e-02 8.46162713e-06]
 [9.28349898e-01 7.16491356e-02 9.66254924e-07]
 [8.41271506e-01 1.58655904e-01 7.25903122e-05]
 [9.23615524e-01 7.63726510e-02 1.18248373e-05]
 [8.97323628e-01 1.02665167e-01 1.12050036e-05]
 [9.21914602e-01 7.80675598e-02 1.78384021e-05]
 [7.99706325e-01 2.00263292e-01 3.03825365e-05]
 [8.32052869e-01 1.67892968e-01 5.41625519e-05]
 [8.91740161e-01 1.08245661e-01 1.41772124e-05]
 [8.03156719e-01 1.96758495e-01 8.47861140e-05]
 [7.95421554e-01 2.04552763e-01 2.56832240e-05]
 [9.00222082e-01 9.97646975e-02 1.32206853e-05]
 [8.30668332e-01 1.69316458e-01 1.52093733e-05]
 [8.20309627e-01 1.79642381e-01 4.79919885e-05]
 [8.47610513e-01 1.52377535e-01 1.19520539e-05]
 [7.95421554e-01 2.04552763e-01 2.56832240e-05]
 [8.81389224e-01 1.18568969e-01 4.18075826e-05]
 [9.40906153e-01 5.90890027e-02 4.84421830e-06]
 [8.32052869e-01 1.67892968e-01 5.41625519e-05]
 [8.25383127e-01 1.74558937e-01 5.79356669e-05]
 [7.88177618e-01 2.11794929e-01 2.74526810e-05]
 [9.00222082e-01 9.97646975e-02 1.32206853e-05]
 [6.90741687e-01 3.09094698e-01 1.63615590e-04]
 [8.91740161e-01 1.08245661e-01 1.41772124e-05]
 [8.47610513e-01 1.52377535e-01 1.19520539e-05]
 [1.08418544e-01 7.68766189e-01 1.22815267e-01]
 [8.61839691e-01 1.38141399e-01 1.89095833e-05]
 [8.57737250e-01 1.42246900e-01 1.58501104e-05]
 [1.07669519e-02 5.83013186e-01 4.06219862e-01]
 [8.57737250e-01 1.42246900e-01 1.58501104e-05]
 [8.79681649e-01 1.20307538e-01 1.08131372e-05]
 [9.09855663e-01 9.01327650e-02 1.15724381e-05]
 [4.75535678e-02 8.43626581e-01 1.08819852e-01]
 [8.79681649e-01 1.20307538e-01 1.08131372e-05]
 [8.20309627e-01 1.79642381e-01 4.79919885e-05]
 [6.90741687e-01 3.09094698e-01 1.63615590e-04]
 [7.99706325e-01 2.00263292e-01 3.03825365e-05]
 [3.09968794e-03 5.96264678e-01 4.00635634e-01]
 [9.64535656e-01 3.54620850e-02 2.25877936e-06]
 [8.79681649e-01 1.20307538e-01 1.08131372e-05]
 [3.30493839e-02 5.28708770e-01 4.38241846e-01]
 [7.99706325e-01 2.00263292e-01 3.03825365e-05]
 [8.81389224e-01 1.18568969e-01 4.18075826e-05]
 [3.09968794e-03 5.96264678e-01 4.00635634e-01]
 [8.79681649e-01 1.20307538e-01 1.08131372e-05]
 [9.33948477e-01 6.60477336e-02 3.78900866e-06]
 [9.09855663e-01 9.01327650e-02 1.15724381e-05]
 [8.30668332e-01 1.69316458e-01 1.52093733e-05]
 [8.31024910e-01 1.68917216e-01 5.78737851e-05]
 [5.81151228e-02 8.19701311e-01 1.22183566e-01]
 [8.81389224e-01 1.18568969e-01 4.18075826e-05]
 [8.60034106e-01 1.39955486e-01 1.04082979e-05]
 [8.73285529e-03 5.96503817e-01 3.94763328e-01]
 [9.28349898e-01 7.16491356e-02 9.66254924e-07]
 [4.17476538e-02 4.77844283e-01 4.80408063e-01]
 [3.69274341e-02 8.38990091e-01 1.24082475e-01]
 [9.09855663e-01 9.01327650e-02 1.15724381e-05]
 [9.28349898e-01 7.16491356e-02 9.66254924e-07]
 [1.07669519e-02 5.83013186e-01 4.06219862e-01]
 [8.25383127e-01 1.74558937e-01 5.79356669e-05]
 [8.67785629e-01 1.32146178e-01 6.81931916e-05]
 [8.30668332e-01 1.69316458e-01 1.52093733e-05]
 [8.91740161e-01 1.08245661e-01 1.41772124e-05]
 [9.46250501e-01 5.37475145e-02 1.98493064e-06]
 [1.03123407e-02 3.65034695e-01 6.24652965e-01]
 [3.09968794e-03 5.96264678e-01 4.00635634e-01]
 [8.72544939e-01 1.27438925e-01 1.61360155e-05]]

References