K-Means Clustering (Unsupervised Learning)
K-Means Clustering | Example code and own notes while taking the course "Intro to Machine Learning" on Udacity.
Steps
- It generates 3 (or n) different random points.
- Assign them the closest points.
- Optimize them each step.
- They will be centered after optimization rounds.
scikit-learn - important parameters
All the values below are set by default:
n_clusters
= 8max_iter
= 300n_init
= 10 (Number of different initializations that you give it. How many times does it initialize the algorithm`)
Local minimum
If the initial centers are like this, it would be a bad local minumum. You have reinit the algorithm to prevent this problem.