ckmeansBreaks
ckmeansBreaks(
x,nClasses):number[]
Defined in: src/ckmeans_breaks.js:19
Given an array of x, this will use Ckmeans clustering to compute
class breaks, in the same [min, ...breaks, max] shape that
equalIntervalBreaks returns. Unlike equalIntervalBreaks, which
divides the range of the data evenly, each internal break here is
the smallest value of the cluster it starts, so classes group
together values that Ckmeans found to be most alike: a value v
falls into class i when breaks[i] <= v < breaks[i + 1], and the
last class also includes the maximum value.
Parameters
Section titled “Parameters”number[]
an array of number values
nClasses
Section titled “nClasses”number
number of desired classes
Returns
Section titled “Returns”number[]
array of class break positions
Example
Section titled “Example”ckmeansBreaks([-1, 2, -1, 2, 4, 5, 6, -1, 2, -1], 3); // => [-1, 2, 4, 6]