May 2018
Beginner to intermediate
356 pages
9h 25m
English
All the supporting and foundational logic for the k-means algorithm is now implemented. The last thing to do is to tie it all together and implement the main loop of the algorithm. To run the algorithm, we should repeat the procedure of assigning points to centroids and then updating centroid locations until the centroids stop moving. We can also perform optional steps such as calculating the error and making sure that the algorithm does not exceed some maximum allowable number of iterations.
Add the following code to the body of the KMeans class:
/** * Run the k-means algorithm until either the solver reaches steady-state, * or the maxIterations allowed has been exceeded. * * The return value from this method is an object with ...
Read now
Unlock full access