Lecture: Lecture 10 - Classification

One problem, different representations

Every classifier tries to assign a class to a new record, but each method describes the decision differently.

MethodMain representationPractical strengthMain limitation
Decision treeSequence of testsEasy to explainCan overfit
Random forestMany randomized treesAccurate and stableHarder to interpret
Rule classifierIf-then conditionsHuman-readable rulesRules may overlap or leave gaps
k-NNNearby stored recordsSimple and incrementalSlow prediction, scale-sensitive
Naive BayesClass probabilitiesFast and compactIndependence assumption
SVMMaximum-margin boundaryStrong accuracyParameter tuning and low interpretability
Neural networkLayered transformationsFlexible and powerfulData, tuning and explanation costs

Random forests

A forest trains many trees on random samples of records and random subsets of features. Each tree votes on a new record, and the majority class becomes the prediction. Bootstrap sampling creates the record subsets. Feature bagging decorrelates the trees so that the same error is less likely to dominate every tree.

The trade-off is clear: forests generally improve stability and accuracy, while a single tree is easier to explain. Feature importance can provide a global summary, but it is not a complete explanation of every individual prediction.

Rules

A rule has the form conditions -> class. For example:

attendance < 75% AND exam < 50 -> at risk

An instance is covered when it satisfies the rule condition. Rules may be mutually exclusive and exhaustive, or they may overlap and leave uncovered instances. Ordered rules resolve overlap by giving earlier rules priority. A default class handles uncovered records.

k-nearest neighbours

k-NN stores the labelled training records. To classify a new student, calculate distance to the stored students, select the k closest and use majority voting. A small k is sensitive to noise. A large k may include records from other classes. Attributes should be normalized because a large numerical scale can dominate distance.

Naive Bayes

Bayesian classification compares P(class | record) across classes. Naive Bayes estimates this using the prior class probability and the product of attribute probabilities given the class. It assumes conditional independence of attributes. The assumption can be false, but the method remains attractive because training and prediction are fast.

Support vector machines

An SVM separates classes with a boundary and chooses the boundary with the largest margin from the closest records. Those closest records are support vectors. A transformed higher-dimensional representation can make a nonlinear boundary possible. SVMs are powerful but require parameter tuning and are difficult to explain to non-specialists.

Retrieval questions

Which method is easiest to explain to a student? Usually a small decision tree or a short rule list, because the prediction can be traced through explicit conditions.

Why normalize data for k-NN? Distance should reflect meaningful differences, not whichever attribute happens to use the largest units.

Why can a forest be more stable than one tree? Different trees see different samples and features, so isolated noise is less likely to control the final majority vote.