Skip to content
Luis Carbonell edited this page Dec 22, 2018 · 6 revisions

Neurons

Useful Links

Usage

Properties

Key Type Default Description
connections [Connection] [] All neuron connections
bias Number Math.random() Check Out:
learning_rate Number 0.3 Check Out:
activation "relu"|"sigmoid"|"tanh"|"step"|"linear"|"leaky-relu"|"softmax"|Function "sigmoid" Check Out:
</td>
Key Description
connections All neuron connections
bias Check out: The Role of Bias in Neural Networks
learning_rate Check out: Overview: What is a "Learning Rate" in a Neural Network

Instance Functions

Key Description
Neuron.prototype.is.input() Tests whether neuron has no input connections
Neuron.prototype.is.output() Tests whether neuron has no output connections
Neuron.prototype.connect() Connects to another neuron, layer, or group
Neuron.prototype.inputs() List of incoming connections
Neuron.prototype.outputs() List of outgoing connections
Neuron.prototype.activate() Activation function of neuron
Neuron.prototype.forward() Forward propagates results of Neuron.prototype.activate()
Neuron.prototype.learn() Updating function of neuron
Neuron.prototype.backward() Backward propagates results of Neuron.prototype.activate()

Class Constants

Key Description
Neuron.activation An object of typical activation/squash functions
Neuron.activation.SIGMOID sigmoid Squash Function
Neuron.activation.ReLU ReLU Squash Function
Neuron.activation.TANH tanh Squash Function
Neuron.activation.IDENTITY identity Squash Function
Neuron.activation.PERCEPTRON perceptron Squash Function
Neuron.update An object of typical activation/squash function derivatives
Neuron.activation.SIGMOID sigmoid Squash Function Partial Derivative
Neuron.activation.ReLU ReLU Squash Function Partial Derivative
Neuron.activation.TANH tanh Squash Function Partial Derivative
Neuron.activation.IDENTITY identity Squash Function Partial Derivative
Neuron.activation.PERCEPTRON perceptron Squash Function Partial Derivative

new Neuron()

  • new Neuron(): Creates a new neuron.
  • new Neuron({ inputs: [n0, n1], outputs: [n2] }): Creates a new neuron with n0 and n1 as incoming connections, and n2 as an outgoing connection.
  • new Neuron(n0): Creates a new neuron with the same connections as n0

.is.input([callback])

  • neuron.is.input(): Returns true if neuron has no incoming connections

.is.output([callback])

  • neuron.is.output(): Returns true if neuron has no outgoing connections

.connect(object[, callback])

  • neuron.connect(other_neuron): Connects neuron to other_neuron
  • neuron.connect(layer): Connects neuron to every neuron in layer
  • neuron.connect(group): Connects neuron to every neuron in group

.inputs([callback])

  • .inputs(): Returns a list of incoming connections to neuron

.outputs([callback])

  • .outputs(): Returns a list of outgoing connections from neuron

.activate(inputs[,callback])

  • .activate([0, 1, 0, 1]): Activates neuron with the given inputs; inputs.length must equal connections.length

forward([callback])

  • .forward(): Propagates the last result of .activate() to all outgoing connections

.learn(feedback[,callback])

  • .learn([1, 0, 1, 0]): Calculates incoming connection errors

.backward([callback])

  • .backward(): Propagates the last results of .learn() to all incoming connections