Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

Dann backpropagate

Matias Vazquez-Levi edited this page Feb 12, 2021 · 4 revisions

Back to Dann

backpropagate( input , target , options );

Train the model's weights.

  • input

Takes an array of input data.


  • target

Takes an array of expected output.


  • options (optional)

An object including specific properties.

Properties
Property Type Function
log Boolean If set to true, it will log a report in the console.
table Boolean If the 'log' option is set to true, setting this value to true will print the arrays of this function in tables.
saveLoss Boolean Whether or not to save the losses in the neural network object. After a lot of training, carrying loss data in the neural network object gets heavy, this is why it is set to false by default.
mode
* for development
String When gpu support will be implemented, specifing the string 'gpu' as opposed to 'cpu' will run the function on a kernel. This funtionality is not yet implemented

Example

//train 1 epoch
for (data of dataset) {
    nn.backpropagate(data.input,data.output);
}

or here is another example

//train 1 epoch
for (data of dataset) {
    nn.backpropagate([0,1],[1]);
    nn.backpropagate([1,0],[1]);
    nn.backpropagate([1,1],[0]);
    nn.backpropagate([0,0],[0]);
}