public class DefaultNeuron extends java.lang.Object implements NeuronModel
Modifier and Type | Field and Description |
---|---|
protected FunctionActivate |
activationFunction
Activation function
|
protected FunctionLearn |
learnFunction
Learning function
|
protected double[] |
weight
Array of the weight
|
Constructor and Description |
---|
DefaultNeuron(double[] weightArray,
FunctionActivate activationFunction)
Creates a new instance of DefaultNeuronWithBias with specified weights
defined in array
|
DefaultNeuron(int weightNumber,
double[] maxWeight,
FunctionActivate activationFunction)
Creates a new instance of DefaultNeuronWithBias with random weights value
|
Modifier and Type | Method and Description |
---|---|
void |
changeNeuronWeight(double[] vector,
double factor)
Change neuron weights for specified neuron number,iteration and input data vector
|
void |
changeNeuronWeight(double[] vector,
double factor,
double influence)
Change neuron weights for specified neuron number,iteration and input data vector
|
FunctionActivate |
getActivationFunction()
Return reference to activation function
|
double |
getValue(double[] inputVector)
Return value of the neuron after activation.
|
double[] |
getWeight()
Returns array contains value of the weights
|
void |
setActivationFunction(FunctionActivate activationFunction)
Set activation function
|
void |
setWeight(double[] weight)
Set weights from array as parameter
|
protected double |
valueTimesWeights(double[] inputVector)
Return value of the neuron after activation.
|
protected double[] weight
protected FunctionLearn learnFunction
protected FunctionActivate activationFunction
public DefaultNeuron(int weightNumber, double[] maxWeight, FunctionActivate activationFunction)
weightNumber
- numbers of weigthsmaxWeight
- max value of the weight. If null or different number of entries to weightNumber
,
then start with random value between 0 and 1.activationFunction
- reference to activation functionpublic DefaultNeuron(double[] weightArray, FunctionActivate activationFunction)
weightArray
- array of weights valueactivationFunction
- reference to activation functionpublic double[] getWeight()
getWeight
in interface NeuronModel
public void setWeight(double[] weight)
setWeight
in interface NeuronModel
weight
- array of the weightspublic double getValue(double[] inputVector) throws java.lang.Exception
getValue
in interface NeuronModel
inputVector
- input vector for neuronjava.lang.Exception
- any error.protected double valueTimesWeights(double[] inputVector) throws java.lang.Exception
inputVector
- input vector for neuronjava.lang.Exception
- any errorpublic void changeNeuronWeight(double[] vector, double factor) throws java.lang.Exception
changeNeuronWeight
in interface NeuronModel
vector
- input data vector.factor
- the iteration number or factor.java.lang.Exception
- any error.public void changeNeuronWeight(double[] vector, double factor, double influence) throws java.lang.Exception
changeNeuronWeight
in interface NeuronModel
vector
- input data vector.factor
- the iteration number or factor.influence
- cells in neighbourhood have a reduced influence.java.lang.Exception
- any error.public FunctionActivate getActivationFunction()
public void setActivationFunction(FunctionActivate activationFunction)
activationFunction
- reference to activation function