← All tutorials

GoCareerGo Tutorials

Machine Learning Tutorial

Supervised learning, classification, neural networks and core ML algorithms.

Logistic Regression

Despite the name, this is a CLASSIFICATION algorithm — it predicts the probability of a binary outcome using the sigmoid function.

from sklearn.linear_model import LogisticRegression

model = LogisticRegression()
model.fit(X_train, y_train)
probabilities = model.predict_proba(X_test)
Tip

Common trick question: 'Is logistic regression used for regression or classification?' — it's classification, despite the name.