MAS-II · Statistical Learning · Free Lesson

Compute K-nearest neighbors (KNN).

Free CAS MAS-II (Modern Actuarial Statistics II) lesson in Statistical Learning. 14 min read, ~2,049 words.

A policy comes in with a driver age of 28 and a credit score of 705. Five similar policies in your training set had losses of $0, $0, $1,200, $0, and $3,400. KNN turns that neighborhood into a prediction with one line of arithmetic.

Why KNN exists. Parametric models impose a functional form (linear, logistic, GLM). KNN imposes none. The training data IS the model, and prediction is a local average over the closest observed cases. That makes KNN powerful when the true decision surface is highly non-linear, and dangerous when features are noisy or unscaled.

Given training set , a query point , and an integer :

Read the full lesson, free →
Worked examples and practice. Free with a free account, no card.

Common mistakes

Bottom line

Exam shortcut

If the problem gives features on wildly different scales and does not mention standardization, assume the examiner wants you to standardize first and recompute; the unstandardized answer is the trap. If the problem asks for the prediction at a single query point with named explicitly, list distances, sort, take the top , and apply majority vote (classification) or mean (regression) in that order; do not skip the sort.

The full lesson (about 2,049 words, 14 min read) adds 2 worked examples, all 6 common mistakes, a self-check, free in the app.

Learning objectives

Browse all free MAS-II lessons or jump into free MAS-II practice questions.