k Nearest Neighbors

I continue to chip away at Data Science from Scratch. This time I tried out Chapter 12: K Nearest Neighbours.

Learnt several few things from this hack:

[1] How to do XML parsing in Python. (blogged about it as well)

[2] Visualization.

[3] Python Coding. Joel’s code is amazing.


Some cool visualizations are as follows:

Here’s how the data looks like plotted onto the US map:



Check out how the variation when the value of K varies from K=1 to K=5.

K=1. This is an example of overfitting.













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