public class ExtendableLearner extends AbstractLearner
Modifier and Type | Field and Description |
---|---|
protected java.util.List |
theDeltaRuleExtenders
The list with delta rule extenders, extenders that change the
delta w, e.g.
|
protected java.util.List |
theGradientExtenders
The list with gradient extenders, extenders that change the gradient.
|
protected UpdateWeightExtender |
theUpdateWeightExtender
The update weight extender, that is, the way to update
the weights, online, batch mode, etc.
|
learnable, learnableLayer, learnableSynapse, monitor
Constructor and Description |
---|
ExtendableLearner()
Creates a new instance of ExtendableLearner
|
Modifier and Type | Method and Description |
---|---|
void |
addDeltaRuleExtender(DeltaRuleExtender aDeltaRuleExtender)
Adds a delta extender.
|
void |
addGradientExtender(GradientExtender aGradientExtender)
Adds a gradient extender.
|
double |
getDefaultDelta(double[] currentGradientOuts,
int j)
Gets the default (normal calculation of) delta.
|
double |
getDefaultDelta(double[] currentInps,
int j,
double[] currentPattern,
int k)
Gets the default (normal calculation of) delta.
|
double |
getDefaultGradientBias(double[] currentGradientOuts,
int j)
Gets the default (normal calculation of the) gradient for biases.
|
double |
getDefaultGradientWeight(double[] currentInps,
int j,
double[] currentPattern,
int k)
Gets the default (normal calculation of the) gradient for weights.
|
protected double |
getDelta(double[] currentGradientOuts,
int j)
Computes the delta value for a bias.
|
protected double |
getDelta(double[] currentInps,
int j,
double[] currentPattern,
int k)
Computes the delta value for a weight.
|
double |
getGradientBias(double[] currentGradientOuts,
int j)
Gets the gradient for biases.
|
double |
getGradientWeight(double[] currentInps,
int j,
double[] currentPattern,
int k)
Gets the gradient for weights.
|
protected double |
getLearningRate(int j)
Gets the learning rate.
|
protected double |
getLearningRate(int j,
int k)
Gets the learning rate.
|
UpdateWeightExtender |
getUpdateWeightExtender()
Gets the update weight extender.
|
protected void |
postBiasUpdate(double[] currentGradientOuts)
Gives learners and extenders a change to do some post-computing after the
biases are updated.
|
protected void |
postBiasUpdateImpl(double[] currentGradientOuts)
Gives learners a change to do some post-computing after the biases are
updated.
|
protected void |
postWeightUpdate(double[] currentPattern,
double[] currentInps)
Gives learners and extenders a change to do some post-computing after the
weights are updated.
|
protected void |
postWeightUpdateImpl(double[] currentPattern,
double[] currentInps)
Gives learners a change to do some post-computing after the weights are
updated.
|
protected void |
preBiasUpdate(double[] currentGradientOuts)
Gives learners and extenders a change to do some pre-computing before the
biases are updated.
|
protected void |
preBiasUpdateImpl(double[] currentGradientOuts)
Gives learners a change to do some pre-computing before the biases are
updated.
|
protected void |
preWeightUpdate(double[] currentPattern,
double[] currentInps)
Gives learners and extenders a change to do some pre-computing before the
weights are updated.
|
protected void |
preWeightUpdateImpl(double[] currentPattern,
double[] currentInps)
Gives learners a change to do some pre-computing before the weights are
updated.
|
void |
requestBiasUpdate(double[] currentGradientOuts)
Override this method to implement what should be done to LearnableLayers
|
void |
requestWeightUpdate(double[] currentPattern,
double[] currentInps)
Override this method to implement what should be done to LearnableSynapses
|
void |
setUpdateWeightExtender(UpdateWeightExtender anUpdateWeightExtender)
Sets an update weight extender.
|
protected void |
updateBias(int j,
double aDelta)
Updates a bias with the calculated delta value.
|
protected void |
updateWeight(int j,
int k,
double aDelta)
Updates a weight with the calculated delta value.
|
getLayer, getMonitor, getSynapse, registerLearnable, setMonitor
protected java.util.List theDeltaRuleExtenders
protected java.util.List theGradientExtenders
protected UpdateWeightExtender theUpdateWeightExtender
public ExtendableLearner()
public final void requestBiasUpdate(double[] currentGradientOuts)
Learner
public final void requestWeightUpdate(double[] currentPattern, double[] currentInps)
Learner
protected void updateBias(int j, double aDelta)
j
- the index of the bias to update.aDelta
- the calculated delta value.protected void updateWeight(int j, int k, double aDelta)
j
- the input index of the weight to update.k
- the output index of the weight to update.aDelta
- the calculated delta value.protected double getDelta(double[] currentGradientOuts, int j)
currentGradientOuts
- the back propagated gradients.j
- the index of the bias.public double getDefaultDelta(double[] currentGradientOuts, int j)
currentGradientOuts
- the back propagated gradients.j
- the index of the bias.protected double getDelta(double[] currentInps, int j, double[] currentPattern, int k)
currentInps
- the forwarded input.j
- the input index of the weight.currentPattern
- the back propagated gradients.k
- the output index of the weight.public double getDefaultDelta(double[] currentInps, int j, double[] currentPattern, int k)
currentInps
- the forwarded input.j
- the input index of the weight.currentPattern
- the back propagated gradients.k
- the output index of the weight.protected double getLearningRate(int j)
j
- the index of the bias (for which we should get the learning rate).protected double getLearningRate(int j, int k)
j
- the input index of the weight (for which we should get the learning rate).k
- the output index of the weight (for which we should get the learning rate).public double getGradientBias(double[] currentGradientOuts, int j)
currentGradientOuts
- the back protected gradients.j
- the index of the bias.public double getDefaultGradientBias(double[] currentGradientOuts, int j)
currentGradientOuts
- the back protected gradients.j
- the index of the bias.public double getGradientWeight(double[] currentInps, int j, double[] currentPattern, int k)
aCurrentInps
- the forwarded input.j
- the input index of the weight.currentPattern
- the back propagated gradients.k
- the output index of the weight.public double getDefaultGradientWeight(double[] currentInps, int j, double[] currentPattern, int k)
aCurrentInps
- the forwarded input.j
- the input index of the weight.currentPattern
- the back propagated gradients.k
- the output index of the weight.protected final void preBiasUpdate(double[] currentGradientOuts)
currentGradientOuts
- the back propagated gradients.protected void preBiasUpdateImpl(double[] currentGradientOuts)
currentGradientOuts
- protected final void preWeightUpdate(double[] currentPattern, double[] currentInps)
currentPattern
- the back propagated gradients.currentInps
- the forwarded input.protected void preWeightUpdateImpl(double[] currentPattern, double[] currentInps)
currentPattern
- the back propagated gradients.currentInps
- the forwarded input.protected final void postBiasUpdate(double[] currentGradientOuts)
currentGradientOuts
- the back propagated gradients.protected void postBiasUpdateImpl(double[] currentGradientOuts)
currentGradientOuts
- the back propagated gradients.protected final void postWeightUpdate(double[] currentPattern, double[] currentInps)
currentPattern
- the back propagated gradients.currentInps
- the forwarded input.protected void postWeightUpdateImpl(double[] currentPattern, double[] currentInps)
currentPattern
- the back propagated gradients.currentInps
- the forwarded input.public void addDeltaRuleExtender(DeltaRuleExtender aDeltaRuleExtender)
aDeltaRuleExtender
- the delta rule extender to add.public void addGradientExtender(GradientExtender aGradientExtender)
aGradientExtender
- the gradient extender to add.public void setUpdateWeightExtender(UpdateWeightExtender anUpdateWeightExtender)
anUpdateWeightExtender
- the update weight extender to set.public UpdateWeightExtender getUpdateWeightExtender()
Submit Feedback to pmarrone@users.sourceforge.net