Lesson 48 of 60
pythonSupervised Learning – Logistic Regression
25 minutes
Course progress80%
Logistic Regression
Logistic regression is used for binary classification. It models the log‑odds of the probability of the positive class.
Logistic function
p = 1 / (1 + exp(-(β0 + β1·x1 + …)))
Using scikit‑learn
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, classification_report, confusion_matrix
log_reg = LogisticRegression(max_iter=, solver=)
log_reg.fit(X_train, y_train)
y_pred = log_reg.predict(X_test)
(, accuracy_score(y_test, y_pred))
(classification_report(y_test, y_pred))
(, confusion_matrix(y_test, y_pred))