
Which scenarios, by themselves, do NOT provide sufficient evidence that a model is overfitting? Select all that apply.
Which of the following statements about overfitting is true?
How might one address the issue of underfitting in a machine learning model.

We’ll explore these questions through visual examples and prediction activities.
Predict the query point’s class using a majority vote of its \(k\) nearest neighbours.
n_neighbors in sklearnSelect all of the following statements which are TRUE.
A decision stump makes one split. Where would you split on \(x\)?
No single threshold works: the Orange points lie between two Blue groups.
Can a decision stump classify these points perfectly now?
Yes! Split on \(x^2 \leq 1.5\): Orange below the threshold, Blue above it.
A kernel is a function that compares two examples. Here, we interpret its output as similarity.
gamma and C.The radial basis function (RBF) kernel gives nearby points higher similarity.
\[ K(x,z) = \exp\!\left(-\gamma\|x-z\|^2\right) \]
| Same point | Nearby points | Far-apart points |
|---|---|---|
| Similarity 1 | Higher similarity | Similarity approaches 0 |
gamma changes similarity\(\gamma > 0\) controls how quickly similarity falls with distance.
| Distance \(r\) | \(\gamma = 0.1\) | \(\gamma = 1\) | \(\gamma = 10\) |
|---|---|---|---|
| 0 | 1 | 1 | 1 |
| 0.5 | 0.975 | 0.779 | 0.0821 |
| 1 | 0.905 | 0.368 | 0.0000454 |
| 2 | 0.670 | 0.0183 | \(4.25\times 10^{-18}\) |
At distance 1, similarity is about 0.9 with \(\gamma=0.1\), but almost zero with \(\gamma=10\).
gammagamma (\(\gamma\)): Similarities falls gradually with distancegamma (\(\gamma\)): Similarities falls quickly with distanceCHow strongly do we penalize training mistakes?
Small C |
Large C |
|---|---|
| Stronger regularization | Weaker regularization |
| More tolerance for training mistakes | More pressure to classify training points correctly |
| Can allow a simpler boundary | Can allow a more intricate boundary |
For a new query point:
SVM learns how to combine similarities during training.
For binary classification, encode Blue as \(-1\) and Orange as \(+1\):
\[ f(x_\text{new}) = \sum_{i\in\text{SV}} \underbrace{\alpha_i}_{\text{learned weight}}\;\underbrace{y_i}_{\text{class sign}}\;\underbrace{K(x_i,x_\text{new})}_{\text{similarity}} + b \]
For example: \(\underbrace{1.2(0.8)}_{\text{Orange}}-\underbrace{0.7(0.5)}_{\text{Blue}}-\underbrace{0.1}_{\text{bias}}=0.51\) \(\quad\Rightarrow\quad\) Orange
gamma and C on decision boundariesC fixed and increase gamma.gamma fixed and increase C.Which settings might underfit or overfit? Choose both using cross-validation.
| \(k\)-NN (uniform weights) | SVM with RBF |
|---|---|
| Find the query’s nearest \(k\) training points | Compare the query with the learned support vectors |
| Each neighbour gets one vote | Each similarity gets a learned, signed weight |
| Neighbours change with the query | Support vectors stay fixed; similarities change |
Select all of the following statements which are TRUE.
sklearn’s RBF SVC, increasing gamma typically increases the training score, but it does not necessarily increase the validation score.gamma but decrease C, we can’t be certain whether the model becomes more or less complex.| Model | Parameters and hyperparameters | Strengths | Weaknesses |
|---|---|---|---|
| Decision Trees | |||
| KNNs | |||
| SVM RBF |
Split \(\to\) Explore \(\to\) Compare \(\to\) Refit \(\to\) Evaluate
Suppose we want to match a student with a compatible roommate using two features:
For this example, we measure similarity using Euclidean distance.
| Candidate | Quiet hours/week | Followers | Euclidean distance calculation | Distance |
|---|---|---|---|---|
| A | 35 | 40,000 | \(\sqrt{5^2 + 15{,}000^2}\) | 15,000.00 |
| B | 37 | 30,000 | \(\sqrt{3^2 + 5{,}000^2}\) | 5,000.00 |
| C | 40 | 50,000 | \(\sqrt{0^2 + 25{,}000^2}\) | 25,000.00 |
| D | 10 | 25,000 | \(\sqrt{30^2 + 0^2}\) | 30.00 |
Based on the distances, the two nearest neighbors (2-NN) are:
What’s the problem here?
Follower counts dominate the distance because of their much larger scale. Candidate D is closest despite preferring 30 fewer quiet hours per week!
