Networks - Yuipas/Nature.js GitHub Wiki

Creation

Networks require an array containing the layers it's going to use.

let layers = [
  new nature.class.Layer({inputSize: 2, units: 4}),
  new nature.class.Layer({units: 1})
];

let network = new nature.class.Network(layers);

It can be also created by using shortcuts.

let network = new nature.FNN(4, 3);

Properties

  • id: Unique id of the object.
  • layers: Array of layers.
  • info: Contains info about the network:
    • inputs: Input size of the network.
    • outputs: Output size of the network.
    • layers: Number of layers of the network.

Functions

  • forward()
  • _forward()
  • toArray()
  • construct()

Description: Activates the network to produce an output. Syntax: Example(s):

xor.forward(0, 0);
xor.forward([0, 0]);
nature.util.print(
     xor.forward([0, 0], [0, 1], [1, 0], [1, 1])
     // xor.forward([0, 0]),
     // xor.forward([0, 1]),
     // xor.forward([1, 0]),
     // xor.forward([1, 1])
);