|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mulan.classifier.neural.model.Neuron
public class Neuron
Implementation of a neuron unit.
The neurons are used as processing elements in NeuralNet
.
Constructor Summary | |
---|---|
Neuron(ActivationFunction function,
int inputDim,
double biasValue)
Creates a new Neuron instance. |
|
Neuron(ActivationFunction function,
int inputDim,
double biasValue,
Collection<Neuron> nextNeurons)
Creates a new Neuron instance. |
|
Neuron(ActivationFunction function,
int inputDim,
double biasValue,
Random random)
Creates a new Neuron instance. |
Method Summary | |
---|---|
boolean |
addAllNeurons(Collection<Neuron> neurons)
Adds connections to all specified Neuron instances. |
boolean |
addNeuron(Neuron neuron)
Adds a connection to a specified Neuron . |
ActivationFunction |
getActivationFunction()
Returns the ActivationFunction used by the Neuron . |
double |
getBiasInput()
Returns a bias input value. |
protected int |
getConnectedNeuronsCount()
Gets the count of neurons connected to the output of this neuron instance. |
double[] |
getDeltas()
Returns deltas of the Neuron . |
double |
getError()
Returns error term of the Neuron . |
double |
getNeuronInput()
Returns an input value of the Neuron . |
double |
getOutput()
Returns the output of the Neuron . |
double[] |
getWeights()
Returns weights of the Neuron . |
double |
processInput(double[] inputs)
Process an input pattern vector and returns the response of the Neuron . |
boolean |
removeNeuron(Neuron neuron)
Removes a connection to a specified Neuron . |
void |
reset()
Performs reset, re-initialization of the Neuron . |
void |
setError(double error)
Sets the error term of the Neuron . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Neuron(ActivationFunction function, int inputDim, double biasValue)
Neuron
instance.
function
- the activation function of the neuroninputDim
- the dimension of input pattern vector the neuron can process (the bias not included).
The input dimension must be greater than zero.biasValue
- the bias input valuepublic Neuron(ActivationFunction function, int inputDim, double biasValue, Random random)
Neuron
instance.
function
- the activation function of the neuroninputDim
- the dimension of input pattern vector the neuron can process (the bias not included).
The input dimension must be greater than zero.biasValue
- the bias input valuerandom
- the pseudo-random generator to be used for computations involving randomness.
This parameter can be null. In this case, new random instance with default seed will be constructed where needed.public Neuron(ActivationFunction function, int inputDim, double biasValue, Collection<Neuron> nextNeurons)
Neuron
instance.
function
- the activation function of the neuroninputDim
- the dimension of input pattern vector the neuron can process (the bias not included)
The input dimension must be greater than zero.biasValue
- the bias input valuenextNeurons
- collection of neurons for which this neuron will be an input.Method Detail |
---|
public ActivationFunction getActivationFunction()
ActivationFunction
used by the Neuron
.
public double[] getWeights()
Neuron
.
Neuron
public double getError()
Neuron
.
public void setError(double error)
Neuron
.
error
- the error valuepublic double[] getDeltas()
Neuron
. Deltas are terms, which are used
to update weights. Here are returned deltas which were computed and used
to update weights in previous learning iteration.
public double processInput(double[] inputs)
Neuron
.
inputs
- input pattern vector
Neuron
public double getOutput()
Neuron
.
The output value is cached from processing of last input.
Neuron
or 0 if no
pattern was processed yet or neuron is after reset.public double getNeuronInput()
Neuron
.
The value is input pattern multiplied with weights and summed
across all weights of particular neuron. The output of the
neuron is then input transformed by activation function.
Neuron
or 0 if no
pattern was processed yet or neuron is after reset.public double getBiasInput()
public boolean addNeuron(Neuron neuron)
Neuron
.
neuron
- the neuron which is connected to the output of this instance.
IllegalArgumentException
- in neuron is nullpublic boolean addAllNeurons(Collection<Neuron> neurons)
Neuron
instances.
neurons
- the collection of neurons which have to be connected to the output of this instance.
IllegalArgumentException
- if neurons collection is nullpublic boolean removeNeuron(Neuron neuron)
Neuron
.
neuron
- the neuron which is connected to the output of this instance.
IllegalArgumentException
- if neuron is nullpublic void reset()
Neuron
.
The weights are randomly initialized, all state variables
(error term, neuron output, neuron input and deltas) are discarded.
protected int getConnectedNeuronsCount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |