https://github.com/mleko/kmeans-clust
k-means clustering in TypeScript
https://github.com/mleko/kmeans-clust
clustering k-means kmeans kmeans-clustering kmeans-clustering-algorithm kmeans-plus-plus typescript
Last synced: about 1 year ago
JSON representation
k-means clustering in TypeScript
- Host: GitHub
- URL: https://github.com/mleko/kmeans-clust
- Owner: mleko
- License: mit
- Created: 2018-11-06T08:14:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-19T19:50:59.000Z (over 7 years ago)
- Last Synced: 2025-04-20T14:06:19.516Z (about 1 year ago)
- Topics: clustering, k-means, kmeans, kmeans-clustering, kmeans-clustering-algorithm, kmeans-plus-plus, typescript
- Language: TypeScript
- Homepage: https://mleko.gitlab.io/kmeans-clust/
- Size: 48.8 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# kmeans-clust
> k-means clustering in TypeScript
[](https://nodei.co/npm/kmeans-clust/)
[](https://travis-ci.org/mleko/kmeans-clust)
### Installation
Library can be installed via [npm](https://www.npmjs.com/package/kmeans-clust).
```
$ npm install kmeans-clust
```
### Example
```typescript
import {kmeans} from "kmeans-clust";
const points = [[0], [1], [9], [10]];
kmeans(points, 2)
//=> [ { centroid: [ 0.5 ], points: [ [Array], [Array] ], error: 1 },
//=> { centroid: [ 9.5 ], points: [ [Array], [Array] ], error: 1 } ]
```
#### To run graphic example execute command
```
$ npm run example
```
Live example is available https://mleko.gitlab.io/kmeans-clust/
### [License (MIT)](LICENSE.md)