k-Nearest Neighbors and Generalization​​

I recently played with the Digit dataset in sklearn.

The exercise gave me good insights into how the number of neighbors plays a important role in model complexity.  A complex model  (in this case when # neighbours=1)  will suffer from overfitting.


Here is how the accuracy numbers look between train and test sets.


Github Code:


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s