wink-perceptron
Multi-class averaged perceptron
Wink Perceptron is a fast and effective way to learn linearly separable patterns from either dense or sparse data. Its averaging function results in better generalization compared to the vanilla implementation of perceptron.
Installation
Use npm to install:
npm install wink-perceptron --save
Getting Started
Here is an example of predicting type of iris plant from the Iris Data Set.
// Load training data — the Iris Data Set obtained from// UCI Machine Learning Repository; it has been converted// into JSON format.// You may need to update the path in the "require" statement// according to your working directory.const trainingExamples = ;// Initialize a test data sample.const testData = setosa: sepalLength: 49 sepalWidth: 3 petalLength: 14 petalWidth: 02 versicolor: sepalLength: 64 sepalWidth: 32 petalLength: 45 petalWidth: 15 virginica: sepalLength: 72 sepalWidth: 36 petalLength: 61 petalWidth: 25 ; // Load wink perceptron.var winkPerceptron = ;// Instantiate wink perceptron.var perceptron = ;// Define configurtaion.perceptron;// Learn from training data.perceptron; // Attempt prediction for each iris plant type.console;// -> Iris-setosaconsole;// -> Iris-versicolorconsole;// -> Iris-virginica
Try experimenting with this example on Runkit in the browser.
Documentation
Check out the perceptron API documentation to learn more.
Need Help?
If you spot a bug and the same has not yet been reported, raise a new issue or consider fixing it and sending a pull request.
About wink
Wink is a family of open source packages for Statistical Analysis, Natural Language Processing and Machine Learning in NodeJS. The code is thoroughly documented for easy human comprehension and has a test coverage of ~100% for reliability to build production grade solutions.
Copyright & License
wink-perceptron is copyright 2017-18 GRAYPE Systems Private Limited.
It is licensed under the terms of the MIT License.