import { KMeansResult } from './KMeansResult.ts'; export type InitializationMethod = 'kmeans++' | 'random' | 'mostDistant'; export interface OptionsWithDefault { distanceFunction?: (p: number[], q: number[]) => number; tolerance?: number; initialization?: InitializationMethod | number[][]; maxIterations?: number; } export interface OptionsWithoutDefault { seed?: number; } export type Options = OptionsWithDefault & OptionsWithoutDefault; /** * Generator version of the algorithm that yields the result of each iteration. * @param data - Points [x,y,z,...] to cluster * @param K - Number of clusters * @param [options] - Option object * @yields {KMeansResult} The result of each iteration. */ export declare function kmeansGenerator(data: number[][], K: number, options: Options): Generator; /** * K-means algorithm * @param data - Points in the format to cluster [x,y,z,...] * @param K - Number of clusters * @param [options] - Option object * @param [options.maxIterations = 100] - Maximum of iterations allowed * @param [options.tolerance = 1e-6] - Error tolerance * @param [options.distanceFunction = squaredDistance] - Distance function to use between the points * @param [options.seed] - Seed for random initialization. * @param [options.initialization = 'kmeans++'] - K centers in format [x,y,z,...] or a method for initialize the data: * You can either specify your custom start centroids, or select one of the following initialization method: * `'kmeans++'` will use the kmeans++ method as described by http://ilpubs.stanford.edu:8090/778/1/2006-13.pdf * `'random'` will choose K random different values. * `'mostDistant'` will choose the more distant points to a first random pick * @returns - Cluster identifier for each data dot and centroids with the following fields: * `'clusters'`: Array of indexes for the clusters. * `'centroids'`: Array with the resulting centroids. * `'iterations'`: Number of iterations that took to converge */ export declare function kmeans(data: number[][], K: number, options: Options): KMeansResult; //# sourceMappingURL=kmeans.d.ts.map