# @types/skmeans

> TypeScript definitions for skmeans

Latest version **0.11.8** (published 2025-01-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/skmeans
pnpm add @types/skmeans
yarn add @types/skmeans
bun add @types/skmeans
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.11.8 |
| Published | 2025-01-30 |
| First published | 2020-03-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51371 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/skmeans
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/skmeans
- npm.io page: https://npm.io/package/@types/skmeans

## Recent versions

- 0.11.8 (latest) — 2025-01-30
- 0.11.7 (ts4.5) — 2023-11-07
- 0.11.4 (ts4.2) — 2023-02-13
- 0.11.3 (ts3.8) — 2021-12-24
- 0.11.2 (ts3.6) — 2021-06-18
- 0.11.1 (ts3.3) — 2021-01-08
- 0.11.0 (ts2.8) — 2020-03-27
- 0.11.6 — 2023-10-18
- 0.11.5 — 2023-09-25

## README

# 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 .

---
_Source: https://npm.io/package/@types/skmeans · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
