Logistic regression models the probability of a class with the sigmoid of a linear score, is trained by minimising cross-entropy (maximum likelihood), and gives a linear decision boundary; GATE asks for probabilities, log-odds, losses and gradient steps.
The sigmoid (logistic) function maps any real to :
; as and as .
Symmetry: .
Derivative: , largest at where it equals .
Inverse (the logit): .
So the model says the log-odds are linear in :
Increasing feature by one unit adds to the log-odds, i.e. multiplies the odds by .
Despite the name, it is a classification method: it outputs a probability and you threshold it.
The sigmoid: the score z = wᵀx + b is turned into a probability; z = 0 is the decision boundary
2. Decision boundary
With threshold 0.5 the rule is: predict 1 when , i.e. when .
The decision boundary is a hyperplane (a line in 2-D), so logistic regression is a linear classifier. is normal to the boundary and points towards class 1.
The distance of from the boundary is ; points far from it get probabilities near 0 or 1.
A threshold moves the boundary to , still parallel to the original.
Curved boundaries need non-linear features (e.g. ); the model stays linear in those features.
Multiclass:softmax regression gives each class a score and
With this reduces to the sigmoid of . Adding the same constant to every does not change the probabilities.
3. Training: maximum likelihood and cross-entropy
With , the likelihood of the labels is . Maximising it is the same as minimising the negative log-likelihood, also called binary cross-entropy or log loss:
A point with costs ; a confident wrong prediction () costs a lot.
is convex in , so any local minimum is global. (Squared error with a sigmoid is not convex, which is one reason it is not used.)
There is no closed-form solution; use gradient descent or Newton's method.
The gradient has the same neat form as in linear regression:
A gradient descent step with learning rate is .
If the classes are linearly separable, the unregularised likelihood keeps improving as , so the weights diverge. Adding an L2 penalty fixes this and reduces overfitting.
4. Logistic regression compared
Linear regression
Logistic regression
Target
real
Output
Loss
squared error
cross-entropy
Solution
closed form (normal equations)
iterative (convex)
Gradient
Against other classifiers:
vs LDA: both give linear boundaries. LDA is generative and assumes Gaussian classes with shared covariance; logistic regression is discriminative and makes no assumption about , so it is more robust when that assumption fails.
vs SVM: both linear; SVM minimises hinge loss and cares only about points near the boundary, while logistic regression uses every point and gives calibrated probabilities.
vs perceptron: a single sigmoid neuron trained with cross-entropy is logistic regression; an MLP stacks many of them.
Use logistic regression when you need probabilities, interpretable coefficients (odds ratios) and a linear boundary is adequate.
Formulas to remember
Sigmoid
Sigmoid properties
Log-odds (logit)
Binary cross-entropyNatural log unless stated
Gradient
Softmax
Common mistakes
Calling logistic regression a regression method for real targets; it is a classifier that outputs probabilities.
Saying a coefficient changes the probability by ; it changes the log-odds by and the odds by a factor .
Expecting a closed-form solution; training is iterative even though the loss is convex.
Using or in cross-entropy when the question means the natural log, or the reverse.
Thinking the decision boundary is curved because the sigmoid is curved; at any fixed threshold the boundary is a hyperplane.
Worked examples
Try each step yourself, then reveal the working.
Example 1: Predicting a probability
numerical
A logistic model has and . Find for and , and classify both with threshold 0.5.
Step 1: Compute the scores.
Try it on paper first.
Example 2: Reading coefficients as odds ratios
numerical
In a loan model the coefficient of 'number of late payments' is . A customer currently has . What happens to the odds and the probability after one more late payment?
Step 1: Find the current odds and log-odds.
Try it on paper first.
Example 3: One gradient descent step
numerical
One training point , . Start at , with learning rate . Do one gradient descent step on the cross-entropy loss.
Step 1: Find the current prediction.
Try it on paper first.
Example 4: Why not squared error?
conceptual
Give two reasons logistic regression is trained with cross-entropy rather than squared error between and .
Step 1: Think about the shape of the loss.
Try it on paper first.
Previous year questions
1 official GATE DA question on this topic, newest first.
9 questions: up to 1 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.
Mark as mastered
Loading your progress…
My revision notes
Notes written by the GATEiit team against the official GATE DA syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.