TARGET DECK MachineLearning::Week-01
Supervised Learning Framework
What are the five components of the supervised learning framework?
A learning problem is specified by:
- Unknown target distribution — what we’re trying to learn
- Training data — drawn i.i.d. from a fixed joint
- Hypothesis set — the family of candidate functions
- Learning algorithm — the procedure for picking one
- Final hypothesis — the chosen function,
Every algorithm in the module differs only in and .
What is the i.i.d. assumption and why does it matter for supervised learning?
Independent and identically distributed: training and test examples are drawn independently from the same joint . It matters because all generalisation guarantees rest on it — if the deployment distribution differs from training (distribution shift), there is no theoretical reason a learned model should perform well, regardless of how good training error looked.
What is generalisation, and why is training accuracy alone not enough?
Generalisation is the ability to perform well on unseen examples drawn from the same . A model that memorises the training set achieves zero training error but may be useless on new data — that’s a lookup table, not learning. Generalisation is the actual goal; training accuracy is a (sometimes misleading) proxy.
Logistic Regression
Why can't we just model directly?
Because ranges over but a probability must lie in . The linear combination has no built-in constraint preventing values like or , neither of which is a valid probability.
What is the logit function and why is it useful for logistic regression?
The logit maps a probability to the real line: but . Modelling puts both sides on the same scale. Inverting gives the sigmoid: .
What is the formula for the sigmoid function and what are its key properties?
- Range: — outputs are valid probabilities
- — maximum uncertainty at the boundary
- Monotonically increasing, smooth, S-shaped
- Saturates: as and as
Used to convert linear scores into class-1 probabilities.
For a logistic regression model with and input , what is the predicted class and confidence?
Compute the linear score: . Since , predict class 1. Confidence: — about 89%.
How do you interpret a logistic regression weight in terms of odds?
A unit increase in feature multiplies the odds of class 1 by : If , a one-unit bump in raises the odds by — a 65% increase. This is why logistic regression is popular in social/natural sciences: the coefficients are directly interpretable.
Decision Boundary
What is the decision boundary of a logistic regression classifier?
The hyperplane . Points where are predicted as class 1 (since ); points where are class 0. The further a point is from the boundary, the more confident the prediction.
Why is logistic regression called a linear model when the sigmoid is non-linear?
“Linear” refers to linearity in the parameters , not in the inputs . The decision boundary is a hyperplane (linear in ), and the cross-entropy loss is convex in . The sigmoid is a fixed non-linearity wrapping a linear-in- score.
Discriminative vs Generative
What is the difference between discriminative and generative classifiers?
- Discriminative: model directly. Doesn’t ask how features are distributed; just learns the decision boundary. Logistic regression, SVM, neural networks.
- Generative: model , then derive via Bayes’ rule. Asks “what does a class-1 input look like?” Naïve Bayes, Gaussian discriminant analysis.
Discriminative is generally better for raw classification accuracy; generative supplies more information (sampling, missing-feature handling) at the cost of stronger modelling assumptions.
A model gets 100% training accuracy but 55% test accuracy. What has gone wrong?
The model has overfitted: it memorised the training data instead of learning generalisable structure. Likely cause: is too expressive relative to the amount of training data, letting the algorithm fit noise. Remedies (covered later): regularisation, more data, simpler model class, validation-based hyperparameter selection.