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

Dann addHiddenLayer

Matias Vazquez-Levi edited this page Feb 1, 2021 · 5 revisions

Back to Dann

addHiddenLayer( size , activation );

Adds one hidden layer.

  • size

    Layer size, the number of neurons in the layer.

  • activation

    Takes a string of the activation function's name. If left empty, the activation function will be set to 'sigmoid' by default. See available activation functions Here.

Example

const nn = new Dann(10,2);

//Add a layer
nn.addHiddenLayer(8,'sigmoid');

//console log
console.log('Added first hidden layer: ')
nn.log({struct:true});

//Add a layer
nn.addHiddenLayer(4,'tanH');

//console log
console.log('Added a second hidden layer: ')
nn.log({struct:true});