If you want to explore a visualization of the machine learning algorithms in JSMLT, check out visualml.io. It provides an interactive environment for using JSMLT's algorithms.
This short guide will help you get started with JSMLT.
We're assuming you've got Node.js and npm installed. If you haven't, you should: download and install it from nodejs.org.
To install JSMLT into your npm project via npm, run
npm install @jsmlt/jsmlt
A simple example
In this small example, we're going to train an SVM on a small example dataset. The code example below starts with loading JSMLT, creating some dummy training and test data, and running an SVM classifier on it. It's pretty simple!
If you want to run this example without having to set up anything by yourself, check out the JSMLT examples repository. It includes the example below, and requires no further setup: it's ready to run!
// Import JSMLT libraryvar jsmlt = ;// Training datatrain_X = -1-1 -11 11 1-1;train_y = 0 0 1 1;// Testing datatest_X = 12 1-2 -1-2 -12;// Create and train classifiervar clf =kernel:;clf;// Make predictions on test dataconsole;
Running this simple example will output the classification result
[1,1,0,0], meaning it classified the first two points as 0, and the second two points as 1.
The entire API documentation can be found here. You can also build the documentation locally by downloading and installing JSMLT and running
npm run-script build-documentation: the documentation will then be available in the
Supervised learning algorithms (classifiers)
- Random Forest:
- Decision Tree:
- Support Vector Machine (SVM):
- Neural Networks:
- k-nearest neighbors:
- Logistic Regression:
Unsupervised learning algorithms (clustering)
- Linear kernel:
- Gaussian (RBF) kernel:
- Polynomial kernel:
- Sigmoid kernel:
- Encode string or other type of labels to integers:
- Data set splitting:
- Iris dataset loading:
- Accuracy metric for validation:
- AUROC metric for validation:
- Classification boundaries for trained classifier:
JSMLT is maintained by Jesper van Engelen, and is in active development. It is currently not ready to be used in any production environments.