UNPKG

@types/skmeans

Version:
53 lines (43 loc) 1.65 kB
# Installation > `npm install --save @types/skmeans` # Summary This package contains type definitions for skmeans (https://github.com/solzimer/skmeans). # Details Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/skmeans. ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/skmeans/index.d.ts) ````ts type CentroidValues<TPoint extends number | number[]> = TPoint[] | "kmrand" | "kmpp"; interface TestResult<TPoint> { idx: number; centroid: TPoint; } interface DataResult<TPoint extends number | number[]> { it: number; k: number; centroids: TPoint[]; idxs: number[]; test: (x: TPoint, distance?: (x: TPoint, y: TPoint) => number) => TestResult<TPoint>; } /** * Calculates unidimiensional and multidimensional k-means clustering on data. * * @param data Unidimiensional or multidimensional array of values to be clustered. * @param k Number of clusters. * @param centroids Initial centroid values. * @param iterations Maximum number of iterations. If not provided, it will be set to 10000. * @param distance Custom distance function. Takes two points as arguments and returns a scalar number. */ declare function skmeans<TPoint extends number | number[]>( data: TPoint[], k: number, centroids?: CentroidValues<TPoint> | null, iterations?: number | null, distance?: (x: TPoint, y: TPoint) => number | null, ): DataResult<TPoint>; export = skmeans; ```` ### Additional Details * Last updated: Thu, 30 Jan 2025 11:32:28 GMT * Dependencies: none # Credits These definitions were written by .