This project is the implementation of K-means clustering algorithm for unsupervised machine learning.
Task from Machine Learning for Greenhorns – Winter 2020/21. Part of this code was provided by Milan Straka.
The algorithm is implemented in k_means.py
. The main method is
k_means
.
The file k_means_main.py
shows how to use the implemented algorithm on some artificial data.
The example of the invocation of the program is:
python k_means_main.py --clusters=7 --examples=200 --iterations=5 --seed=67 --init=kmeans++ --plot=plot
clusters
specifies the number of clusters to generateexamples
specifies the amount of data points to be generatediterations
is the number of iterations of the K-means algorithmseed
specifies the random seedinit
specifies the initialization of the cluster centers, can berandom
orkmeans++
plot
is the name of output file of the plot
The result of the previous invocation is the following output file: