This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 23
Dann Object
Matias Vazquez-Levi edited this page Mar 28, 2021
·
30 revisions
const Dann = require('dannjs').dann;
When you create a neural network, you need to specify the size of the input & output layers.
const nn = new Dann(2,2);
-
This value represents the architecture of the model in the form of an array.
-
This defines the learning rate of the model. This value is set to
0.001
by default. -
This is an empty value. This is meant for you to increase whenever you have completed one epoch. This serves as a way to save the number of epochs along with the weights in the dannData.json file.
-
This is the most recent loss value of the model. If the model has never been trained before, this value will be set to 0.
Deprecation warning : dataObject( ) & applyToModel() are deprecated as of v2.2.4f
Here is a neural network training to solve XOR:
const Dann = require('dannjs').dann; //nodejs only
// 128 input , 8 output Model with 3 hidden layers
const nn = new Dann(128,8);
nn.addHiddenLayer(64,'leakyReLU');
nn.addHiddenLayer(32,'leakyReLU');
nn.addHiddenLayer(16,'tanH');
nn.makeWeights();
nn.outputActivation('sigmoid');
nn.setLossFunction('mae');
nn.lr = 0.01;
nn.log();