Learning Machines w2 hw: k-means clustering

Not gonna lie, I pair-programmed this with a software engineer who specializes in machine learning. I was able to code the initial setup just fine, but somehow failed to make the connection that the data points were vectors, and all the calculation required was just vector math. Being new to python—and having forgotten all my high school math—this assignment was pretty overwhelming, but with some help I feel like I now understand k-means clustering pretty well.

Would like to update this later so that the data points change color based on which cluster set it belongs to. The plots currently are not very legible.

Click for full image.

Steps taken to group 50 data points into 4 clusters.

Steps taken to group 100 data points into 5 clusters.

Full code here: https://github.com/xujenna/learning_machines/blob/master/kmeans_clustering.py

Leave a Reply

Your email address will not be published. Required fields are marked *