encog
https://www.npmjs.com/package/encog
Encog is a NodeJs ES6 framework based on the Encog Machine Learning Framework by Jeff Heaton.
All credits of the framework should go to Jeff Heaton - http://www.heatonresearch.com/encog/
Based on the encog-java-core v3.4 - https://github.com/encog/encog-java-core
Full documentation and source code - https://github.com/redsoul/encog
Installation
npm install encog --save
Usage
Just require the library and all of Encog namespace will be available to you:
const Encog = ;
Unit Tests
npm install --only=dev
npm test
Implemented algorithms
- Networks
- Basic Network
- Hopfield Network
- BAM (Bidirectional associative memory) Network
- Freeform Network
- Training
- Back Propagation
- Manhattan Propagation
- Resilient Propagation
- Stochastic Gradient Descent
- Momentum
- Nesterov
- RMS Prop
- AdaGrad
- Adam
- Levenberg Marquardt
- Neural Simulated Annealing
- Patterns
- ADALINE
- Feed Forward (Perceptron)
- Elman Network
- Jordan Network
- Hopfield Network
- BAM Network
- Activation Functions
- Elliott
- Symmetric Elliott
- Gaussian
- Linear
- Ramp
- ReLu
- Sigmoid
- Softmax
- Steepened Sigmoid
- Hyperbolic tangent
- Error Functions
- Arctangent
- Cross Entropy
- Linear
- Output
Examples
Back Propagation example using XOR Data Set
const Encog = ;const XORdataset = EncogUtilsDatasets; //adjust the log levelEncogLogoptionslogLevel = 'info'; // create a neural networkconst network = ;network;network;network;network; const train = network XORdatasetinput XORdatasetoutput; EncogUtilsNetwork;const accuracy = EncogUtilsNetwork;console;
Resilient Propagation example using Iris Flower Data Set (https://en.wikipedia.org/wiki/Iris_flower_data_set)
const Encog = ;const _ = ; //adjust the log levelEncogLogoptionslogLevel = 'info'; const dataEncoder = ;let irisDataset = EncogUtilsDatasets;irisDataset = _;irisDataset = EncogPreprocessingDataToolbox; /******************///data normalization/******************/ //apply a specific mapping to each columnconst mappings = 'Sepal.Length': 'Sepal.Width': 'Petal.Length': 'Petal.Width': 'Species': ; //Fit to data, then transform it.let trainData = dataEncoder;//transform the test data based on the train datalet testData = dataEncoder; //slice the data in input and outputtrainData = EncogPreprocessingDataToolbox;testData = EncogPreprocessingDataToolbox; // create a neural networkconst network = ;network;network;network;network;network; // train the neural networkconst train = network trainDatainput trainDataoutput;EncogUtilsNetwork; //validate the neural networklet accuracy = EncogUtilsNetwork;console; //save the trained networkEncogUtilsFile; //load a pretrained networkconst newNetwork = EncogUtilsFile; //validate the neural networkaccuracy = EncogUtilsNetwork;console;
Stochastic Gradient Descent with Adam update example using the bank note authentication dataset
const Encog = ;const _ = ;const dataEncoder = ; //adjust the log levelEncogLogoptionslogLevel = 'info'; async { const dataset = await EncogPreprocessingDataToolbox; const shuffledDataset = _; const splittedDataset = EncogPreprocessingDataToolbox; /******************/ //data normalization /******************/ //apply a specific mapping to each column const mappings = 'variance': 'skewness': 'curtosis': 'entropy': 'class': ; //Fit to data, then transform it. let trainData = dataEncoder; //transform the test data based on the train data let testData = dataEncoder; //slice the data in input and output trainData = EncogPreprocessingDataToolbox; testData = EncogPreprocessingDataToolbox; // create a neural network const network = ; network; network; network; network; network; network; // train the neural network const train = network trainDatainput trainDataoutput ; EncogUtilsNetwork; //validate the neural network let accuracy = EncogUtilsNetwork; console; //save the trained network EncogUtilsFile; //load a pretrained network const newNetwork = EncogUtilsFile; //validate the neural network accuracy = EncogUtilsNetwork; console;};
Hopfield Network example custom binary dataset
const Encog = ;const _ = ;const hopfieldPatterns = EncogUtilsDatasets;const HopfieldPattern = ; //adjust the log levelEncogLogoptionslogLevel = 'info'; HopfieldPattern;const network = HopfieldPattern; _; network;const input = 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0;const result = network;console; /*Output: 0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 1, 0, 0, 0,0, 1, 1, 0, 0,0, 1, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 0, 0*/
Node.js version compatibility
8.0.0 or higher