gk-knn
v1.0.3
Published
A light K-nearest neighbor module created by Georgios Kontopoulos
Downloads
1
Readme
gk-knn
About
gk-knn
is a library of k-nearest neighbors written in JavaScript.
Table of Contents
Examples
Node
getType
Execute getType with file name, test instance, k and fields to exclude as arguments.
node examples/getType.js 'iris.csv' '{"sepal_length":1,"sepal_width":2,"petal_length":3,"petal_width":4}' 7 ['type']
or with default parameters
node examples/getType.js
getAccuracy
Execute getAccuracy with file name and fields to exclude as arguments.
node examples/getAccuracy.js 'iris.csv' ['type','sepal_length', 'sepal_width']
node examples/getAccuracy.js 'iris.csv' ['type']
or with default parameters
node examples/getAccuracy.js
Browser
TODO
Usage
Node usage
If you have node, you can install gk-knn.js
with npm:
npm install gk-knn
Or if you prefer yarn:
yarn add gk-knn
At present, the published version of gk-knn 1.0.3
Browser usage
TODO Download the latest gk-knn.js for browser.
Data format
Currently only .csv files are supported.
csv
The first line should hold label names.
sepal_length,sepal_width,petal_length,petal_width,type
5.1,3.5,1.4,0.2,Iris-setosa
4.9,3.0,1.4,0.2,Iris-setosa
4.7,3.2,1.3,0.2,Iris-setosa
...
JSON
TODO