Skip to main content
Module

x/simplestatistics/index.js>kMeansCluster

simple statistics for node & browser javascript
Go to Latest
function kMeansCluster
import { kMeansCluster } from "https://deno.land/x/simplestatistics@v7.7.5/index.js";

Perform k-means clustering.

Examples

kMeansCluster([[0.0, 0.5], [1.0, 0.5]], 2); // => {labels: [0, 1], centroids: [[0.0, 0.5], [1.0 0.5]]}

Parameters

points

N-dimensional coordinates of points to be clustered.

numCluster

How many clusters to create.

optional
randomSource = [UNSUPPORTED]

An optional entropy source that generates uniform values in [0, 1).