@kanaries/ml
v0.0.7
Published
machine learning lib in javascript
Downloads
1
Maintainers
Readme
@kanaries/ml
machine learning lib in javascript
Usage
npm i --save @kanaries/ml
examples:
import { Neighbors } from '@kanaries/ml';
const trainX = [
[0.12, 0.2, ..., 0.2],
[0.21, 0.3, ..., 0.2],
...
];
const trainY = [0, 1, ..., 1];
const knn = new Neighbors.KNearstNeighbors(3, 'distance', '2-norm');
knn.fit(trainX, trainY);
const testX = [
[0.52, 0.72, ..., 0.24],
[0.11, 0.98, ..., 0.32],
...
];
knn.predict(testX)
// [2, 1, ..., 0]