Problem: Using k-means clustering but when you want a consistent result every time.

*(this will be re-written soon - right now this is an outline)*

centroids will differ for multiple runs on the same data - known k-means problem. some kind of 'local minima' issue

using nearest neighbor search for computing suitable initial clusters centroids instead of random ones

then apply k-means procedure to refine the clusters

work on a copy of vectors !!!

n = vectors.length

picks the first point in X,

Smallest whole number greater than or equal to [ n / x ] xCEIL

then computes its Math.ceil(n/k) - 1 nearest neighbors which constitute the first cluster C1

whose centroid is set to c1,

then C1 is deleted from X. - remove candidate center from vectors

This process is repeated k times until the k initial cluster centers c1, c2,...,ck are assigned.

use nearest neighbor to find initial cluster centers -

algorithm implementation in Javascript from research papers: from A Deterministic K-means Algorithm based on Nearest Neighbor Search