K-Means from Scratch
by David Lettier
Using plain vanilla JavaScript, we built the K-Means algorithm from scratch as well as the silhouette coefficient metric. We discussed different mean initialization techniques and went into depth about Fouad Kahn’s approach. The assignment and update steps were discussed where the data-points are assigned to their closest means and the means are updated by averaging the features of their currently assigned data-points. To not lock up our interface we used requestAnimationFrame and cycled our iterations for both K-Means and the silhouette coefficient metric. Lastly, we discussed one way of determining how well our data is clustered using the silhouette coefficient metric and went over some unintuitive cases.





