Loading

Quipoin Menu

Learn • Practice • Grow

machine-learning / Logistic Regression
tutorial

Logistic Regression

Despite its name, logistic regression is used for classification (binary outcomes: yes/no, spam/not spam). It estimates the probability that an instance belongs to a class.

Logistic regression applies the sigmoid function to linear regression output, squeezing values between 0 and 1 (probability).

Example: Email Spam Detection

Features: word frequencies, sender, time. Output: probability of being spam. If probability > 0.5, classify as spam.
from sklearn.linear_model import LogisticRegression

model = LogisticRegression()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
probabilities = model.predict_proba(X_test)[:,1]

Decision Boundary

Logistic regression finds a line (or hyperplane) that separates the two classes. Points on one side are class 0, on the other side class 1.

Interpretation

The coefficients tell you how each feature influences the log‑odds of the outcome. Positive coefficient → increases probability of class 1.


Two Minute Drill
  • Logistic regression is for binary classification.
  • Outputs probability between 0 and 1 via sigmoid.
  • Default threshold 0.5 (adjustable).
  • Use LogisticRegression from sklearn.

Need more clarification?

Drop us an email at career@quipoinfotech.com