-
-
Notifications
You must be signed in to change notification settings - Fork 34
Neuron
Luis Carbonell edited this page Dec 27, 2018
·
6 revisions
Useful Links
Creating a Neuron
let Neuron = require('@liquid-carrot/carrot').Neuron
let n = new Neuron()
Activating a Neuron
let Neuron = require('@liquid-carrot/carrot').Neuron
let n = new Neuron()
n.activate(Math.random(), function(error, results) {
console.log(results) // 0.4254387327
})
Teaching a Neuron
let Neuron = require('@liquid-carrot/carrot').Neuron
let n = new Neuron()
n.propagate(0, function(error, fault) {
console.log(results) // 0.124511366
})
Connecting two Neurons
let Neuron = require('@liquid-carrot/carrot').Neuron
let n0 = new Neuron()
let n1 = new Neuron()
n0.project(n1, function(error, connection) {
console.log(connection)
})
new Neuron()
-
new Neuron()
: Creates a new neuron. -
new Neuron({ inputs: [n0, n1], outputs: [n2] })
: Creates a new neuron withn0
andn1
as incoming connections, andn2
as an outgoing connection. -
new Neuron(n0)
: Creates a new neuron with the same connections asn0
.is.input([callback])
-
neuron.is.input()
: Returnstrue
ifneuron
has no incoming connections; Invokes callback(error, isInput)
.is.output([callback])
-
neuron.is.output()
: Returnstrue
ifneuron
has no outgoing connections; Invokes callback(error, isOutput)
.project(object[, callback])
-
neuron.project(other_neuron)
: Connectsneuron
toother_neuron
; Invokes callback(error, connections) -
neuron.project(layer)
: Connectsneuron
to every neuron inlayer
; Invokes callback(error, connections) -
neuron.project(group)
: Connectsneuron
to every neuron ingroup
; Invokes callback(error, connections)
.activate(inputs[,callback])
-
.activate([0, 1, 0, 1])
: Activatesneuron
with the giveninputs
;inputs.length
must equalconnections.length
; Invokes callback(error, results)
.propagate(feedback[,callback])
-
.propagate([1, 0, 1, 0])
: Calculates incoming connection errors; Invokes callback(error, results)
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.project() |
Connects to another neuron , layer , or group
|
Neuron.prototype.activate() |
Activates neuron and forward propagates results |
Neuron.prototype.learn() |
Calculates error, updates weights, and backward propagates error |
Key | Description |
---|---|
Neuron.activations |
An object of typical activation/squash functions |
Neuron.activations.SIGMOID |
sigmoid Squash Function |
Neuron.activations.RELU |
ReLU Squash Function |
Neuron.activations.TANH |
tanh Squash Function |
Neuron.activations.LINEAR |
identity Squash Function |
Key | Type | Default | Description |
---|---|---|---|
connections |
Object |
[] |
All neuron connections |
connections.incoming |
[Connection] |
[] |
All incoming neuron connections |
connections.outgoing |
[Connection] |
[] |
All outgoing neuron connections |
bias |
Number |
Math.random() |
Check Out: |
rate |
Number |
0.3 |
Check Out: |
activation |
"relu" |"sigmoid" |"tanh" |"linear" |Function
|
"sigmoid" |
Check Out: |