Skip to content

k-means implementation for 2D points data ( SDL )

Notifications You must be signed in to change notification settings

levibyte/kmeans_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kmeans_demo

The question is following: Given number K and some data, classify and put data into K buckets.

This is silly atempt to address this question by implementing k-means, the most basic classification algorithm. For simplicty and visbility reasons I've choosen data to be 2d points on the surface.

Overall algorithm's yield is very much depends on data distribution ( are they allready "split" into K buckets or spread randomly?) and on the choice of first pivot points. Therfore on some occasions it can split data ideally but next time it can be completly wrong.

Run examples

Left: raw data, Right: after classification to buckets ( via color )

          

Same, but for larger gravity values:

          

Fail case: