1. University MCA (AI/ML) Semester 2
  2. CAB212
  3. Unit 3

CAB212 · Unit 3: Classification

Logistic regression and the sigmoid

8 practice questions

Key points

  • Sigmoid maps scores to probabilities
  • z = 0 -> p = 0.5
  • Trained with log loss
  • Linear decision boundary

Despite its name, logistic regression is a classification model. It computes a linear score z = w.x + b and squashes it with the sigmoid:

p = 1 / (1 + e^-z), giving a probability in (0, 1).

  • z = 0 gives p = 0.5, the default decision boundary (threshold 0.5).
  • z = ln 3 gives p = 0.75; large positive z gives p near 1.
  • The decision boundary w.x + b = 0 is linear.

It is trained by minimising log loss (binary cross-entropy): L = -[y log p + (1 - y) log(1 - p)], usually with gradient descent. Odds = p / (1 - p) and log-odds = z, so each weight is a change in log-odds per unit of the feature.

For more than two classes use softmax (multinomial) or one-vs-rest. Regularization (L1/L2) is applied the same way as in linear regression.

Exam pitfall: MSE is not the standard loss for logistic regression; log loss is, because it is convex for this model.

Try two questions

Question 1 · Tier 3, Apply

The quantity modelled linearly by logistic regression is the:

  1. Distance to centroid
  2. Probability directly
  3. Squared error
  4. Log-odds
Show the answer

D. log(p/(1-p)) = w.x + b.

Question 2 · Tier 1, Recall

Logistic regression is used mainly for:

  1. Clustering
  2. Time-series smoothing only
  3. Classification
  4. Dimensionality reduction
Show the answer

C. It outputs class probabilities.