|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.huguesjohnson.jail.neuralNetwork.Neuron
class Neuron base class for neuron objects contains a functionality that is common to all neurons
Constructor Summary | |
Neuron()
default constructor |
|
Neuron(double[] input,
double[] weights,
double desiredOutput,
double punishRate,
double rewardRate,
double errorThreshold)
constructor |
|
Neuron(double punishRate,
double rewardRate,
double errorThreshold)
constructor |
|
Neuron(double desiredOutput,
double punishRate,
double rewardRate,
double errorThreshold)
constructor |
Method Summary | |
abstract double |
activation()
activation function for the neuron |
abstract void |
adjustWeights()
adjust the weights for this neuron |
double |
getDesiredOutput()
returns the desired output of the neuron |
boolean |
getDoneTraining()
returns whether or not the neuron is done training |
double |
getErrorThreshold()
returns the error threshold for the neuron |
double[] |
getInput()
getInput |
double |
getInput(int index)
getInput returns a specific input in the neuron |
int |
getInputCount()
returns the number of inputs to this neuron |
protected double[] |
getInputs()
getInputs same getInput, just around for backwards compatibility |
double |
getOutput()
returns the output (activation) of this neuron |
double |
getPunishRate()
returns the punish rate for the neuron |
double |
getRewardRate()
returns the reward rate for the neuron |
double |
getWeight(int index)
getWeight retreives a specific weight in the neuron |
int |
getWeightCount()
returns the number of weights for this neuron |
double[] |
getWeights()
getWeights |
double |
getZ()
getZ computes a summation of all inputs*weights |
void |
punishWeight(int index)
move weight closer to zero |
void |
randomizeWeights(int numWeights,
double min,
double max)
sets random values for weights |
void |
rewardWeight(int index)
move weight farther away from zero |
double |
run()
run computes the value and output of the neuron |
double |
run(double[] input)
run computes the value and output of the neuron |
double |
run(double[] input,
double[] weights)
run computes the value and output of the neuron |
void |
setDesiredOutput(double desiredOutput)
sets the desired output for the neuron |
void |
setDoneTraining(boolean doneTraining)
sets whether or not the neuron is done training |
void |
setErrorThreshold(double errorThreshold)
sets the error threshold for the neuron |
void |
setInput(double[] input)
setInput |
void |
setPunishRate(double punishRate)
sets the punish rate for the neuron |
void |
setRewardRate(double rewardRate)
sets the reward rate for the neuron |
void |
setWeight(int index,
double value)
setWeight sets a specific weight in the neuron |
void |
setWeights(double[] weights)
setWeights |
java.lang.String |
toString()
returns a string representation of the object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Neuron()
public Neuron(double desiredOutput, double punishRate, double rewardRate, double errorThreshold)
desiredOutput
- the desired output of the neuronpunishRate
- the punish rate of the neuronrewardRate
- the reward rate of the neuronerrorThreshold
- the error threshold of the neuronpublic Neuron(double punishRate, double rewardRate, double errorThreshold)
punishRate
- the punish rate of the neuronrewardRate
- the reward rate of the neuronerrorThreshold
- the error threshold of the neuronpublic Neuron(double[] input, double[] weights, double desiredOutput, double punishRate, double rewardRate, double errorThreshold)
input
- the input to the neuronweights
- the weights on the links to the neurondesiredOutput
- the desired output of the neuronpunishRate
- the punish rate of the neuronrewardRate
- the reward rate of the neuronerrorThreshold
- the error threshold of the neuronMethod Detail |
public final double getZ()
public final void setInput(double[] input)
input
- data for neuronpublic final void setWeights(double[] weights)
weights
- for neuronpublic final double[] getWeights()
protected final double[] getInputs()
public final double[] getInput()
public final void randomizeWeights(int numWeights, double min, double max)
numWeights
- number of weights to generatemin
- minimum weight valuemax
- maximum weight valuepublic final void setWeight(int index, double value) throws NeuronException
index
- index of weight to setvalue
- value to set
NeuronException
- if bad value is passed for indexpublic final double getWeight(int index) throws NeuronException
index
- index of weight to get
NeuronException
- if bad index is passedpublic final double getInput(int index) throws java.lang.IndexOutOfBoundsException
index
- index of input to get
java.lang.IndexOutOfBoundsException
- if bad index is passedpublic final double run() throws NeuronException
NeuronException
- if number of inputs and weights do not matchpublic final double run(double[] input) throws NeuronException
input
- array of input for neuron
NeuronException
- if number of inputs and weights do not matchpublic final double run(double[] input, double[] weights) throws NeuronException
input
- array of input for neuronweights
- array of weights for neuron
NeuronException
- if number of inputs and weights do not matchpublic final boolean getDoneTraining()
public final void setDoneTraining(boolean doneTraining)
doneTraining
- new training status for neuronpublic final void setDesiredOutput(double desiredOutput)
desiredOutput
- the desired output for the neuronpublic final double getDesiredOutput()
public final void setPunishRate(double punishRate)
punishRate
- new punish ratepublic final double getPunishRate()
public final void setRewardRate(double rewardRate)
rewardRate
- new reward ratepublic final double getRewardRate()
public final void setErrorThreshold(double errorThreshold)
errorThreshold
- new error thresholdpublic final double getErrorThreshold()
public final void punishWeight(int index)
index
- the index of the weight to punishpublic final void rewardWeight(int index)
index
- the index of the weight to rewardpublic final int getWeightCount()
public final int getInputCount()
public final double getOutput()
public java.lang.String toString()
toString
in class java.lang.Object
public abstract double activation()
public abstract void adjustWeights()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |