@ppz/k-means-pp@2.2.0
latest
ppzreboot/k-means-pp.jsA JS/TS implementation of the k-means and k-means++ clustering algorithm.
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
JSR Score
100%
Published
5 hours ago (2.2.0)
k-means-pp.js
A JS/TS implementation of the k-means and k-means++ clustering algorithm.
- Implements both k-means and k-means++ algorithms
- Supports multi-dimensional data points
- Works in any JavaScript environment, including browsers, Node.js, Deno and more
Installation
deno
deno add @ppz/k-means-pp
npm
npm install k-means-pp
Usage
import { KMPP } from 'k-means-pp' const kmpp = new KMPP({ dimension: 3, data: [ [1,2,3], [0, 270, 103], [3,4,5], [0,0,0], [100, 200, 1], [0, 310, 120], [10, 320, 90], [100, 201, 3], [0, 300, 100], [1000, 2000, 1], ], }) const result1 = kmpp.k_means_pp(8) console.log(result1.means) const result2 = kmpp.k_means(6) console.log(result2.means)
Add Package
deno add @ppz/k-means-pp
Import symbol
import * as mod from "@ppz/k-means-pp";
---- OR ----
Import directly with a jsr specifier
import * as mod from "jsr:@ppz/k-means-pp";
Add Package
npx jsr add @ppz/k-means-pp
Import symbol
import * as mod from "@ppz/k-means-pp";
Add Package
yarn dlx jsr add @ppz/k-means-pp
Import symbol
import * as mod from "@ppz/k-means-pp";
Add Package
pnpm dlx jsr add @ppz/k-means-pp
Import symbol
import * as mod from "@ppz/k-means-pp";
Add Package
bunx jsr add @ppz/k-means-pp
Import symbol
import * as mod from "@ppz/k-means-pp";