Anny on

Class: Neuron

Neuron

A Neuron is the base unit of the network. They are connected by a Connection It's purpose is to sum its inputs and compute an output. During training, a Neuron will adjust the weights of its outgoing Connections to other Neurons.

Neurons are organized into Layers

Constructor

new Neuron(activationopt, learningRateopt)

Parameters:
Name Type Attributes Default Description
activation object <optional>
ACTIVATION.tanh

An object containing an activation function and its first derivative. Typically selected from ACTIVATION.

learningRate number <optional>
INITIALIZE.learningRate()

The rate at which this Neuron should update its Connection weights during training. Usually a very small number (ie 0.01 - 0.5), experiment for optimal results.

Source:

Classes

Connection

Members

(static) count :number

A running total number of Neurons created.

A running total number of Neurons created. It is only used to generate unique ids for each Neuron. Creating a new Neuron increments the count but it is never decremented.

Type:
  • number
Source:

activation :ACTIVATION.tanh|Object|*

Type:
Source:

id :number

A unique id beginning at 0 and incremented for every Neuron created.

A unique id beginning at 0 and incremented for every Neuron created.

Type:
  • number
Source:

incoming :Array

An array of incoming Connections from other Neurons.

An array of incoming Connections from other Neurons.

Type:
  • Array
Source:
See:

input :number

The input value of the last activation.

The input value of the last activation.

Type:
  • number
Source:

isBias :boolean

Flag identifying this Neuron as a Bias Neuron.

Flag identifying this Neuron as a Bias Neuron. Bias Neurons are like regular Neurons, except they have no incoming Connections and always output 1.

Type:
  • boolean
Source:

outgoing :Array

An array of outgoing Connections to other Neurons.

An array of outgoing Connections to other Neurons.

Type:
  • Array
Source:
See:

output :number

The output value of the last activation.

The output value of the last activation.

Type:
  • number
Source:

Methods

accumulateGradients()

Calculate and accumulate Connection weight gradients.

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

Source:

activate(inputopt) → {number}

Activate this Neuron, setting the input value and computing the output.

Activate this Neuron, setting the input value and computing the output. Input Neuron output values will always be equal to their input value. Bias Neurons always output 1. All other Neurons will squash their input value to derive their output.

Parameters:
Name Type Attributes Description
input number <optional>

If omitted the input value will be calculated from the outputs and weights of the Neurons connected to this Neuron.

Source:
Returns:
Type
number

backprop(deltaopt) → {number}

Set this Neuron's delta value, or compute it if omitted.

Set this Neuron's delta value, or compute it if omitted.

Parameters:
Name Type Attributes Description
delta number <optional>

If omitted, the delta value will be calculated from the deltas and weights of the Neurons this Neuron is connected to.

Source:
Returns:
Type
number

connect(target, weight)

Connect this Neuron to another Neuron.

Connect this Neuron to another Neuron.

Parameters:
Name Type Description
target Neuron

The Neuron to connect to.

weight number

The strength of the connection.

Source:

isInput() → {boolean}

Determine if this Neuron is an input Neuron.

Determine if this Neuron is an input Neuron.

Source:
Returns:
Type
boolean

isOutput() → {boolean}

Determine if this Neuron is an output Neuron.

Determine if this Neuron is an output Neuron.

Source:
Returns:
Type
boolean

updateWeights()

Update Connection weights and reset their accumulated gradients.

Update Connection weights and reset their accumulated gradients.

Source: