aroraayush / k-means-clustering-implementation-sklearn

Custom implementation for k-means in python, comparison with the one in sklearn.

Repository from Github https://github.comaroraayush/k-means-clustering-implementation-sklearnRepository from Github https://github.comaroraayush/k-means-clustering-implementation-sklearn

k-means-clustering

Custom Implementation

  • Cluster class : link
  • k-means class: link
Output
  • Labels and Centroids coordinates.
([0, 1, 3, 2, 0, 3, 1, 3, 3, 3, 3, 0, 1, 1, 0, 3, 2, 2, 2, 0, 2, 1, 0, 1, 0, 0, 2, 0, 0, 3, 2, 3, 1, 0, 1, 3, 1, 3, 3, 2, 2, 2, 2, 3, 0, 1, 3, 2, 2, 3, 2, 1, 1, 2, 3, 2, 1, 0, 3, 0, 2, 3, 0, 3, 2, 3, 0, 2, 1, 1, 0, 0, 3, 3, 1, 2, 1, 1, 0, 0, 2, 3, 0, 1, 1, 3, 3, 0, 1, 1, 2, 2, 2, 3, 3, 0, 1, 2, 3, 3, 2, 0, 0, 2, 2, 1, 3, 0, 0, 3, 2, 1, 1, 0, 0, 3, 1, 1, 2, 3, 2, 1, 3, 0, 3, 1, 3, 1, 0, 3, 1, 0, 1, 2, 2, 1, 2, 2, 0, 2, 0, 1, 0, 0, 1, 0, 3, 0, 1, 2, 2, 2, 3, 1, 0, 3, 2, 1, 2, 0, 2, 0, 0, 1, 1, 2, 3, 0, 0, 1, 0, 3, 1, 2, 2, 2, 3, 3, 1, 3, 1, 0, 3, 0, 3, 1, 1, 2, 3, 2, 0, 0, 3, 2, 1, 1, 1, 3, 2, 0], [[2.071878923404346, 0.9742292639681066], [-1.624014149548755, 2.915962902631501], [-1.3484271494315723, 7.720965481677161], [0.9079396154722764, 4.3571379124853165]])

sklearn Implementation

  • Comparing custom implementation and sklearn version - link

About

Custom implementation for k-means in python, comparison with the one in sklearn.


Languages

Language:Jupyter Notebook 99.4%Language:Python 0.6%