• Martin Thoma
  • Home
  • Categories
  • Tags
  • Archives
  • Support me

k-nearest-neighbor classification and k-means - an interactive example

Contents

  • k-nearest-neighbor classification and k-means - an interactive example
    • Changelog
    • See also

When the circle has exactly the same number of blue / green dots in it, it will be green.

When you move the mouse over the box, everything will be calculated and drawn again. This leads to flickering with k-means, as k-means includes a random choice of cluster centers.

Changelog

Version Change
2.2 Cluster centers have the same color as the clustered points; when one cluster has no points (and there are at least as many points as clusters) everything gets recalculated
2.1 users can now specify an arbitrary number of classes; ctrl-key change of class was removed; added hints to configuration options
2.0 k-means implemented
1.0 k-nearest neighbor implemented

Code is on GitHub. You may use it for free, but you should add a link to this article.

See also

One interesting setting for k=2
One interesting setting for k=2
k-means: Good vs. Bad
k-means: Good vs. Bad
  • Voronoi diagram
  • K-nearset neighbor
  • k-means clustering
  • Udacity: Introduction to A.I: k-means

Published

Mai 19, 2013
by Martin Thoma

Category

Code

Tags

  • canvas 3
  • Clustering 4
  • HTML5 5
  • JavaScript 7
  • k-means 1
  • KogSys 5

Contact

  • Martin Thoma - A blog about Code, the Web and Cyberculture
  • E-mail subscription
  • RSS-Feed
  • Privacy/Datenschutzerklärung
  • Impressum
  • Powered by Pelican. Theme: Elegant by Talha Mansoor