MACHINE LEARNING IN PYTHON: iNTERMEDIATE > MISSION 5 > K-MEANS CLUSTERING

K-means Clustering

In the last module, we discussed unsupervised machine learning and briefly learned about a clustering algorithm that groups data points together and identifies patterns from the groups of data: K-Means clustering. While we just covered the tip of the iceberg with K-Means in the previous module, we'll explore K-Means clustering as we explore how NBA players are different from one another.

K-Means clustering is a popular centroid-based clustering algorithm that we will use. The “K” in K-Means refers to the number of clusters we want to segment our data into. The key part with K-Means (and most unsupervised machine learning techniques) is that we have to specify what “k” is. There are advantages and disadvantages to this, but one advantage is that we can pick the “k” that makes the most sense for our use case.

Not only knowing how to implement the algorithm on a dataset, but understanding what is happening behind the scenes is critical so you can understand what assumptions are being made and can quickly debug. That said, In addition to learning about K-Means clustering, you will also learn about the mathematics that goes on when you implement K-Means using a machine learning library, such as scikit-learn.

As you work through each concept, you’ll get to apply what you’ve learned from within your browser — there's no need to use your own machine to do the exercises. The Python environment inside of this course includes answer checking so you can ensure that you've fully mastered each concept before learning the next concept.

Objectives

  • Learn to implement the k-means clustering algorithm from scratch.
  • Learn some of the challenges of k-means clustering.

Mission Outline

1. Clustering NBA Players
2. Point Guards
3. Points Per Game
4. Assist Turnover Ratio
5. Visualizing the Point Guards
6. Clustering players
7. The Algorithm
8. Visualize Centroids
9. Setup (continued)
10. Step 1 (Euclidean Distance)
11. Step 1 (Continued)
12. Visualizing Clusters
13. Step 2
14. Repeat Step 1
15. Repeat Step 2 and Step 1
16. Challenges of K-Means
17. Conclusion
18. Takeaways

machine-learning-intermediate

Course Info:

Intermediate

The median completion time for this course is 5.6 hours. View Details

This course requires a premium subscription and includes 1 free mission and 5 paid missions, which includes 1 guided project.  It is the 21st course in the Data Scientist in Python path.

START LEARNING FREE

Take a Look Inside