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. |
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.
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. |
Returns:
- Array of Neuron output values.
- Type
- Array.<number>
backprop(deltasopt) → {Array.<number>}
Sets all the Neuron delta
s in this Layer to the given array of values.
Sets all the Neuron delta
s 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. |
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. |
size()
Returns the number of Neurons in this Layer, excluding Bias Neurons.
Returns the number of Neurons in this Layer, excluding Bias Neurons.
updateWeights()
Update Neuron Connection weights and reset their accumulated gradients.
Update Neuron Connection weights and reset their accumulated gradients.