Back to the 2025 paper

Unit 3: Classification & Regression

20257m

Write short note on: Logistic Regression and Sigmoid Function

Worked SolutionAI Assisted

Logistic Regression and Sigmoid Function:

Logistic Regression:
Discriminative linear classifier for binary classification. Despite name, it's classification, not regression. Models posterior P(y=1∣x)=σ(wTx+b)P(y=1|x)=\sigma(w^T x + b) where σ\sigma is sigmoid.

  • Hypothesis: hw(x)=σ(wTx+b)∈(0,1)h_w(x)=\sigma(w^T x+b)\in(0,1)
  • Decision: predict 1 if hw≥0.5h_w\ge0.5 (wTx+b≥0w^T x+b\ge0) else 0 — linear boundary.
  • Loss: Binary cross-entropy (log loss) J(w)=−1m∑[ylog⁡h+(1−y)log⁡(1−h)]J(w)= -\frac1m\sum [y\log h + (1-y)\log(1-h)] — convex MLE under Bernoulli.
  • Gradient: $
    abla J = \frac1m X^T (h-y)$, solved via SGD, Newton.
  • Regularization: L2L2 λ∣∣w∣∣2\lambda||w||^2 prevents overfit.
  • Multi-class extends via softmax P(y=k∣x)=ewkTx/∑ewjTxP(y=k|x)=e^{w_k^T x}/\sum e^{w_j^T x} (Multinomial Logistic).
  • Interpretable: coefficients as log-odds ratio, exp⁡(wj)\exp(w_j) = odds multiplier for unit feature increase.
  • Use when need probabilities, linear separable, baseline for text, medical.

Sigmoid Function:
σ(z)=11+e−z\sigma(z)=\frac1{1+e^{-z}}, shape S-curve (−∞→0,0→0.5,+∞→1)( -\infty\to0, 0\to0.5, +\infty\to1), derivative σ′(z)=σ(z)(1−σ(z))\sigma'(z)=\sigma(z)(1-\sigma(z)).

Properties: squashes real to (0,1), smooth, differentiable, but suffers vanishing gradient for large ∣z∣|z| (near 0 or 1) — replaced by ReLU in deep hidden layers but still core for logistic output, gating (LSTM).

Example: z=0→0.5z=0→0.5, z=2→0.881z=2→0.881, z=−2→0.119z=-2→0.119.

Together, sigmoid makes linear score interpretable as probability, optimized via cross-entropy, yielding calibrated classifier.

Similar questions

AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.