Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Dann Object

Matias Vazquez-Levi edited this page Mar 28, 2021 · 30 revisions

Back to Home

Import

const Dann = require('dannjs').dann;

Contructor( inputSize , outputSize )

When you create a neural network, you need to specify the size of the input & output layers.

const nn = new Dann(2,2);

Object Properties

  • arch

    This value represents the architecture of the model in the form of an array.

  • lr

    This defines the learning rate of the model. This value is set to 0.001 by default.

  • epoch

    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.

  • loss

    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.




Function properties

Model Creation

Model Interaction

Weight Mutations

Save & load

Save & load JSON

Deprecation warning : dataObject( ) & applyToModel() are deprecated as of v2.2.4f

Static

Debug


Example

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();