UNPKG

ml-kmeans

Version:
39 lines 2.21 kB
/** * Calculates the distance matrix for a given array of points * @ignore * @param {Array<Array<number>>} data - the [x,y,z,...] points to cluster * @param {function} distance - Distance function to use between the points * @return {Array<Array<number>>} - matrix with the distance values */ export declare function calculateDistanceMatrix(data: number[][], distance: (a: number[], b: number[]) => number): number[][]; /** * Updates the cluster identifier based in the new data * @ignore * @param {Array<Array<number>>} data - the [x,y,z,...] points to cluster * @param {Array<Array<number>>} centers - the K centers in format [x,y,z,...] * @param {Array <number>} clusterID - the cluster identifier for each data dot * @param {function} distance - Distance function to use between the points * @return {Array} the cluster identifier for each data dot */ export declare function updateClusterID(data: number[][], centers: number[][], clusterID: number[], distance: (a: number[], b: number[]) => number): number[]; /** * Update the center values based in the new configurations of the clusters * @ignore * @param {Array<Array<number>>} prevCenters - Centroids from the previous iteration * @param {Array <Array <number>>} data - the [x,y,z,...] points to cluster * @param {Array <number>} clusterID - the cluster identifier for each data dot * @param {number} K - Number of clusters * @return {Array} he K centers in format [x,y,z,...] */ export declare function updateCenters(prevCenters: number[][], data: number[][], clusterID: number[], K: number): number[][]; /** * The centers have moved more than the tolerance value? * @ignore * @param {Array<Array<number>>} centers - the K centers in format [x,y,z,...] * @param {Array<Array<number>>} oldCenters - the K old centers in format [x,y,z,...] * @param {function} distanceFunction - Distance function to use between the points * @param {number} tolerance - Allowed distance for the centroids to move * @return {boolean} */ export declare function hasConverged(centers: number[][], oldCenters: number[][], distanceFunction: (a: number[], b: number[]) => number, tolerance: number): boolean; //# sourceMappingURL=utils.d.ts.map