k-means algorithm module for n-dimensional data

Overview

K-Means Algorithm

This module allows you to compute the k-Means algorithm with n-dimensional data. You simply put in your data as a list and the k you want to use. The return will be a list containing the means of the classes and the related list of data for each mean.

Usage via Commandline

deno run --allow-net https://deno.land/x/[email protected]/test.ts  //or newer version

Usage Example

import {Kmeans} from "./src/kmeans.ts"
var testdata:Array<number[]>=[[1,2,3],[3,6,2],[4,8,3],[34,64,7],[23,46,12],[123,34,2],[23,35,23],[2,5,3],[5,2,7],[65,3,7]]
const km=new Kmeans()
console.log(km.getkmeans(testdata, 5))

Output

[
  [ 3, 4.6, 3.6 ],
  [ 53.6, 36.4, 10.2 ],
  [ [ 1, 2, 3 ], [ 3, 6, 2 ], [ 4, 8, 3 ], [ 2, 5, 3 ], [ 5, 2, 7 ] ],
  [ [ 34, 64, 7 ], [ 23, 46, 12 ], [ 123, 34, 2 ], [ 23, 35, 23 ], [ 65, 3, 7 ] ]
]
You might also like...

Non-interactive publicly verifiable distributed key generation and resharing algorithm over BLS12-381

NPVDKG-RS This repository contains a mathematical presentation and some code to demonstrate our developed non-interactive publicly verifiable distribu

May 19, 2022

๐Ÿค–A Tic-Tac-Toe solver that uses the minimax algorithm and alpha-beta pruning to make it unbeatable

๐Ÿค–A Tic-Tac-Toe solver that uses the minimax algorithm and alpha-beta pruning to make it unbeatable

Tic-Tac-Toe AI A Tic-Tac-Toe solver that uses the minimax algorithm and alpha-beta pruning to make it unbeatable How it Works Tic-Tac-Toe is what is k

May 20, 2022

Fast and robust triangle-triangle intersection test with high precision for cross and coplanar triangles based on the algorithm by Devillers & Guigue.

fast-triangle-triangle-intersection Fast and robust triangle-triangle intersection test with high precision for cross and coplanar triangles based on

Nov 15, 2022

โญ๏ธ my baekjoon algorithm

Baekjoon Algorithm Python3 import sys # ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„๋œ 2๊ฐœ ์ˆซ์ž ์ž…๋ ฅ ๋ฐ›๊ธฐ N, M = map(int, sys.stdin.readline().split()) # ์—ฌ๋Ÿฌ ์ค„ ์ž…๋ ฅ ๋ฐ›๊ธฐ n = int(sys.stdin.readline

Jul 22, 2022

This project will be using various AI and Rule Engine algorithm to detect various attack against a company!

This project will be using various AI and Rule Engine algorithm to detect various attack against a company!

๐Ÿ“Œ Introduction This project will be using various AI and Rule Engine algorithm to detect various attack against a website! ๐Ÿ“Œ Mission After starting

Apr 29, 2022

A Flood-Fill Algorithm written in JavaScript

flood https://magnogen.net/flood A Flood-Fill Algorithm for Creative Coders This is the source code for a section of my website. You're welcome to sno

Dec 22, 2022

Deno's first lightweight, secure distributed lock manager utilizing the Redlock algorithm

Deno-Redlock Description This is an implementation of the Redlock algorithm in Deno. It is a secure, lightweight solution to control resource access i

Dec 31, 2022

An algorithm for fast 2D pattern-matching with wildcards.

An algorithm for fast 2D pattern-matching with wildcards.

pattern-match-2d.js An algorithm for fast 2D pattern-matching with wildcards, with a demo app inspired by MarkovJunior (by Maxim Gumin). The algorithm

Nov 5, 2022

The Google Earth Engine implementation of the BioNet algorithm to estimate biophysical parameters along with their uncertainties.

The Google Earth Engine implementation of the BioNet algorithm to estimate biophysical parameters along with their uncertainties.

ee-BioNet The Google Earth Engine implementation of the BioNet algorithm to estimate biophysical parameters along with their uncertainties. Quantifyin

Oct 30, 2022
Owner
null
Hemsida fรถr personer i Sverige som kan och vill erbjuda boende till mรคnniskor pรฅ flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo fรถr kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Drag and drop library for two-dimensional, resizable and responsive lists

DEPRECATED This project is no longer maintained, please consider using react-grid-layout instead. GridList Drag and drop library for a two-dimensional

Hootsuite 3.6k Dec 14, 2022
An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format. It can be used in Node.js and browser applications.

An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format. It can be used in Node.js and browser applications.

Snyk Labs 57 Dec 28, 2022
A personal semantic search engine capable of surfacing relevant bookmarks, journal entries, notes, blogs, contacts, and more, built on an efficient document embedding algorithm and Monocle's personal search index.

Revery ?? Revery is a semantic search engine that operates on my Monocle search index. While Revery lets me search through the same database of tens o

Linus Lee 215 Dec 30, 2022
Algorithm visualizer made with React, Material UI and P5JS.

Made with React, P5JS and Material UI. Link https://andresrodriguez55.github.io/algorithmsVisualizer/#/ Description The purpose of doing this was to l

Andres Arturo Rodriguez Calderon 31 Nov 22, 2022
JS_GAME/Algorithm

?? JS_GAME JavaScript ๋ฅผ ์ด์šฉํ•˜์—ฌ ๊ฐ์ข… ๊ฒŒ์ž„์„ ๋งŒ๋“ค์–ด๋ณด์ž. (์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๊ฒŒ์ž„์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Œ.) ์›นํŽ˜์ด์ง€๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ๋„ ์ข‹์ง€๋งŒ, JS ๋ฅผ ์ด์šฉํ•˜์—ฌ ๊ฐ„๋‹จํ•œ ๊ฒŒ์ž„์„ ๋งŒ๋“ค๋ฉด์„œ ์ƒ๊ฐ์˜ ์ „ํ™˜์„ ํ•ด๋ณด์ž. ํด๋ก  ์ฝ”๋”ฉ๋„ ์ข‹๋‹ค! ํ•˜์ง€๋งŒ, ํด๋ก  ์ฝ”๋”ฉ ํ›„์—

LEEJAE-GO 2 Nov 5, 2021
NodeJS Implementation of Decision Tree using ID3 Algorithm

Decision Tree for Node.js This Node.js module implements a Decision Tree using the ID3 Algorithm Installation npm install decision-tree Usage Import

Ankit Kuwadekar 204 Dec 12, 2022
A deterministic object hashing algorithm for Node.js

Deterministic-Object-Hash A deterministic object hashing algorithm for Node.js. The Problem Using JSON.stringify on two objects that are deeply equal

Zane Bauman 7 Nov 30, 2022
Dominating set solver using quantum algorithm Grover

Solution for dominating set problem using improved quantum algorithm Grover, which uses Schoning algorithm for k-SAT problem to accomplish this improvement

Fatemehe Lajevardi 8 Aug 31, 2022