Anny on

Class: Layer

Layer

Layers are collections of Neurons. They can do all the things Neurons can do by invoking methods on all the Neurons in the Layer.

Layers are organized into a Network

Constructor

new Layer(size, learningRateopt, activationopt)

Creates a single dimension Layer of Neurons.

Parameters:
Name Type Attributes Description
size number

The number of Neurons this Layer should have.

learningRate number <optional>

The learning rate passed directly to the Neuron constructor.

activation object <optional>

The activation function passed directly to the Neuron constructor.

Source:
See:

Methods

accumulateGradients()

Calculate and accumulate Neuron Connection weight gradients.

Calculate and accumulate Neuron Connection weight gradients. Does not update weights. Useful during batch/mini-batch training.

Source:

activate(valuesopt) → {Array.<number>}

Activates all the Neurons in this Layer with the given array of values.

Activates all the Neurons in this Layer with the given array of values.

Parameters:
Name Type Attributes Default Description
values Array.<number> <optional>
[]

Map of input values for each Neuron.

Source:
Returns:
  • Array of Neuron output values.
Type
Array.<number>

backprop(deltasopt) → {Array.<number>}

Sets all the Neuron deltas in this Layer to the given array of values.

Sets all the Neuron deltas in this Layer to the given array of values.

Parameters:
Name Type Attributes Default Description
deltas Array.<number> <optional>
[]

Delta values, one for each Neuron.

Source:
Returns:
Type
Array.<number>

connect(targetLayer)

Connects every Neuron in this Layer to each Neuron in the target Layer.

Connects every Neuron in this Layer to each Neuron in the target Layer.

Parameters:
Name Type Description
targetLayer Layer

The Layer to connect to.

Source:

size()

Returns the number of Neurons in this Layer, excluding Bias Neurons.

Returns the number of Neurons in this Layer, excluding Bias Neurons.

Source:

updateWeights()

Update Neuron Connection weights and reset their accumulated gradients.

Update Neuron Connection weights and reset their accumulated gradients.

Source: