A generic interface for Neurons.
It includes getters and setters for a neuron's weight and biases.
Classes inheriting from this interface should implement a `_process`
function that takes an array of bits of size equal to the neuron's
list of weights.
- Source:
Methods
bias(n)
Get or set the Perceptron's bias value.
Parameters:
Name | Type | Description |
---|---|---|
n |
number | The new bias value. If undefined, returns the current bias value. |
- Source:
process(input)
Given an array of input bits, return the neuron's output.
If the array of input bits is a different length than
the neuron's list of weights, it will throw an error.
If `_process` is unimplemented, it will also throw an error.
Parameters:
Name | Type | Description |
---|---|---|
input |
array | An array of input bits. |
- Source:
weight(i, n)
Get or set the neuron's weight value for a given input bit.
Parameters:
Name | Type | Description |
---|---|---|
i |
number | The index of the weight to get or set. |
n |
number | The new value for the specified weight. If undefined, returns the current weight value. |
- Source:
weights(weights)
Get or set the entire array of the neuron's weights.
Parameters:
Name | Type | Description |
---|---|---|
weights |
array | The new list of weights. If undefined, returns the current list of weights. |
- Source: