Classification and Conditional Class Probabilities

Context: FIT2086_MOC Β· the categorical-target half of supervised learning β€” the branch Linear Regression (FIT2086) left open Β· the W6 machinery (ML fitting, penalised likelihood) now aimed at the Bernoulli instead of the Gaussian Β· the practical answer βž” Logistic Regression Β· scoring the result βž” Classification Evaluation (Confusion Matrix and Metrics)

Quick Revision

  • 🎯 Objective: define a classifier as the conditional class probability βž” estimate it βž” predict the class that maximises it.
  • πŸ“¦ Core Components: direct joint estimation βž” exact but cells | naive Bayes βž” simplifying assumption | Logistic Regression βž” models the conditional directly.
  • ⚑ Key Constraint: the curse of dimensionality β€” estimating the joint table needs probabilities for binary predictors, which outruns any ⟹ the direct approach is unusable past a handful of predictors.

πŸ“ How It Works

1. A Classifier Is a Conditional Probability

  • Target βž” is categorical (a class); predictors are called features in the classification literature.
  • What we want βž” β€” the probability an individual is in class given their feature values.
  • Probabilistic vs hard classifier βž” a probabilistic classifier returns the whole distribution over classes; a hard classifier collapses it to one label by .
  • Why probabilities and not labels βž” they carry confidence: and give the same label but are not the same claim βž” Logarithmic Loss.

2. The Direct Approach β€” Joint Then Conditional

  • All-categorical case βž” the conditional is a ratio of a joint to a marginal:
  • Reading it βž” numerator is the joint probability of class-and-features; denominator is the marginal probability of the features alone βž” the product/sum rules of Random Variables and Probability Distributions (FIT2086), nothing new.
  • Consequence βž” the joint distribution is a complete classifier β€” once you hold it, every conditional falls out by division.

3. Estimating the Joint from Data

  • We are never given the joint βž” the population table is unknown; only realisations are observed.
  • Proportion estimator βž” count the pair and divide by :
  • Why it works βž” the WLLN (Expectations and Covariance (FIT2086)) guarantees these proportions converge on the population probabilities for large enough .
  • Conditional from estimates βž” β€” divide the cell by its column total.

4. Why the Direct Approach Collapses

  • The count βž” binary and binary ⟹ joint probabilities; two mutations ⟹ ; binary predictors ⟹ cells.
  • Exponential growth in βž” each cell needs its own sample of observations to estimate, so the demand on doubles per predictor βž” this is the curse of dimensionality.
  • Practical verdict βž” the requirement outruns the sample size no matter how big is ⟹ the problem must be constrained, not estimated cell by cell.

5. The Two Escape Routes

  • Naive Bayes βž” impose a simplifying assumption on the joint (features independent given the class) βž” handles categorical predictors and multi-class targets easily; popular in text mining. (Named in the lecture, not examined β€” self-study.)
  • Logistic Regression βž” skip the joint entirely and model the conditional directly as an adaptation of the linear model βž” handles categorical and continuous predictors; awkward for multi-class.
  • The unit’s choice βž” logistic regression, because it inherits the whole linear-model toolkit.

6. Generative vs Discriminative

  • Generative model βž” any model of the complete joint βž” conditioning on gives , so it can generate synthetic individuals of a chosen class.
  • Dividing by βž” removes the class’s own prevalence, leaving what the features look like within that class.
  • Why they are topical βž” modern generative models exploit structural regularities in the data type to beat the exponential-growth problem rather than estimating raw cells.
  • Discriminative model βž” models only βž” cheaper, cannot generate data, and is what Logistic Regression does.

πŸ”¬ Model

  • Declared spaces βž” (binary throughout this unit), features or a finite categorical product space.
  • Estimation target βž” the conditional , not the mean β€” this is the only structural change from Linear Regression (FIT2086).
  • Decision rule βž” ; for binary this is β€œpredict iff ” βž” generalised by a threshold in ROC and AUC.
  • Parameter count of the direct approach βž” free probabilities for binary features ⟹ non-viable; every practical method replaces this with parameters.

βš–οΈ Core Decision Matrix

ApproachWhat it estimatesParameter costPredictor typesWhere it breaks
Direct joint tablefull joint cellscategorical onlycurse of dimensionality past
Naive Bayesjoint, under an independence assumptioncategorical, multi-class easythe independence assumption is usually false
Logistic Regressionconditional directly coefficientscategorical and continuousmulti-class is awkward; boundary is linear

When It Flips: with small, all-categorical predictors and a large , the direct table is exact and assumption-free β€” it beats logistic regression, which forces a linear log-odds shape. Every added predictor doubles its cost, so the crossover arrives almost immediately.

πŸ“Š Exam Execution Trace & Applied Exercises

Applied Exercise 1 β€” estimate a classifier from raw data

Problem: individuals with mutation status and heart disease . Estimate the joint table, then and .

Final Extracted Output: in this sample the non-mutation group looks more likely to have heart disease β€” the reverse of the population table below, because is far too small. (Slide 21 prints for the second line; β€” arithmetic slip, the method is right.)

Applied Exercise 2 β€” the same classifier from population probabilities

Problem: population joint probabilities of heart disease and LDLR mutation : , , , . Classify a mutation carrier and a non-carrier.

Final Extracted Output: carrier βž” predict (); non-carrier βž” predict (). The mutation raises risk by percentage points.

Applied Exercise 3 β€” odds and the predictor verdict (Studio 12 sample exam)

Problem: joint probabilities of dense breasts and breast cancer by 60 : , , , . Find , , the odds of cancer given dense breasts, and judge as a predictor.

Shortcut: the marginal cancels in the odds βž” straight from the joint row (W12 revision: attendance row ⟹ passes per fail). Final Extracted Output: a good predictor β€” cancer is as likely with dense breasts; the verdict needs this comparison of the two conditionals, never one conditional alone.

⚠️ Common Mistakes

  • πŸ’‘ Dividing by instead of the column total βž” the conditional divides the joint cell by the marginal of the conditioning variable, not by the sample size; is the joint, is the conditional.
  • πŸ’‘ Calling the direct approach β€œwrong” βž” it is exact and assumption-free; it fails only on cost (), which is a sample-size problem, not a correctness one.
  • πŸ’‘ Confusing generative with β€œbetter” βž” a generative model estimates strictly more than a classifier needs; for pure prediction the discriminative conditional is the cheaper and usually the stronger choice.
  • πŸ’‘ Reading a small-sample proportion as the population value βž” the WLLN is asymptotic; at the estimated table can invert the true relationship entirely.

🧠 Active Recall