k-Means clustering using Nebula.js

This Glitch showcases how you can use an Engine API based function KMeans2D() to build an on the fly Scatter plot and implement k-Means clustering.

The focus of the project is to show:

  1. the potential of Nebula.js in using the chart expressions.
  2. how to use 'dimension expressions' instead of independent fields in Nebula.js viz.
  3. apply advanced analytics to problems.
  4. explain the parameter 'num_of_cluster' used in the algorithm.

Problem:

Consider the following scenario. An analyst needs to explore geographical data for a variety of neighborhoods in Toronto to help the city’s crime department set up some hotspots to monitor the neighborhoods and analyze the criminal activities in an effective way. Segregating the neighborhoods into five different clusters based on some kind of similarities between them would be the first step.