public abstract class SupervisedLearning extends IterativeLearning implements Serializable
Modifier and Type | Field and Description |
---|---|
protected double |
maxError
Max allowed network error (condition to stop learning)
|
protected double |
previousEpochError
Total network error in previous epoch
|
currentIteration, learningRate, stopConditions
listeners, neuralNetwork, trainingSet
Constructor and Description |
---|
SupervisedLearning()
Creates new supervised learning rule
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterEpoch() |
protected void |
beforeEpoch() |
protected abstract void |
calculateWeightChanges(double[] outputError)
This method should implement the weights update procedure for the whole network
for the given output error vector.
|
protected void |
doBatchWeightsUpdate()
This method updates network weights in batch mode - use accumulated weights change stored in Weight.deltaWeight
It is executed after each learning epoch, only if learning is done in batch mode.
|
void |
doLearningEpoch(DataSet trainingSet)
This method implements basic logic for one learning epoch for the
supervised learning algorithms.
|
ErrorFunction |
getErrorFunction() |
double |
getMaxError()
Returns learning error tolerance - the value of total network error to stop learning.
|
double |
getMinErrorChange()
Returns min error change stopping criteria
|
int |
getMinErrorChangeIterationsCount()
Returns number of iterations count for for min error change stopping criteria
|
int |
getMinErrorChangeIterationsLimit()
Returns number of iterations for min error change stopping criteria
|
double |
getPreviousEpochError()
Returns total network error in previous learning epoch
|
double |
getTotalNetworkError() |
boolean |
isBatchMode()
Returns true if learning is performed in batch mode, false otherwise
|
void |
learn(DataSet trainingSet,
double maxError)
Trains network for the specified training set and maxError
|
void |
learn(DataSet trainingSet,
double maxError,
int maxIterations)
Trains network for the specified training set, maxError and number of iterations
|
protected void |
learnPattern(DataSetRow trainingElement)
Trains network with the input and desired output pattern from the specified training element
|
protected void |
onStart()
This method is executed when learning starts, before the first epoch.
|
void |
setBatchMode(boolean batchMode)
Sets batch mode on/off (true/false)
|
void |
setErrorFunction(ErrorFunction errorFunction) |
void |
setMaxError(double maxError)
Sets allowed network error, which indicates when to stopLearning training
|
void |
setMinErrorChange(double minErrorChange)
Sets min error change stopping criteria
|
void |
setMinErrorChangeIterationsLimit(int minErrorChangeIterationsLimit)
Sets number of iterations for min error change stopping criteria
|
doOneLearningIteration, getCurrentIteration, getLearningRate, getMaxIterations, hasReachedStopCondition, isIterationsLimited, isPausedLearning, learn, learn, pause, resume, setLearningRate, setMaxIterations
addListener, fireLearningEvent, getNeuralNetwork, getTrainingSet, isStopped, onStop, removeListener, setNeuralNetwork, setTrainingSet, stopLearning
protected transient double previousEpochError
protected double maxError
public SupervisedLearning()
protected abstract void calculateWeightChanges(double[] outputError)
outputError
- output error vector for some network input (aka. patternError, network error)
usually the difference between desired and actual outputpublic final void learn(DataSet trainingSet, double maxError)
trainingSet
- training set to learnmaxError
- learning stop condition. If maxError is reached learning stopspublic final void learn(DataSet trainingSet, double maxError, int maxIterations)
trainingSet
- training set to learnmaxError
- learning stop condition. if maxError is reached learning stopsmaxIterations
- maximum number of learning iterationsprotected void onStart()
IterativeLearning
onStart
in class IterativeLearning
protected void beforeEpoch()
beforeEpoch
in class IterativeLearning
protected void afterEpoch()
afterEpoch
in class IterativeLearning
public void doLearningEpoch(DataSet trainingSet)
doLearningEpoch
in class IterativeLearning
trainingSet
- training set for training networkprotected final void learnPattern(DataSetRow trainingElement)
trainingElement
- supervised training element which contains input and desired outputprotected void doBatchWeightsUpdate()
public boolean isBatchMode()
public void setBatchMode(boolean batchMode)
batchMode
- batch mode settingpublic void setMaxError(double maxError)
maxError
- network errorpublic double getMaxError()
public double getPreviousEpochError()
public double getMinErrorChange()
public void setMinErrorChange(double minErrorChange)
minErrorChange
- value for min error change stopping criteriapublic int getMinErrorChangeIterationsLimit()
public void setMinErrorChangeIterationsLimit(int minErrorChangeIterationsLimit)
minErrorChangeIterationsLimit
- number of iterations for min error change stopping criteriapublic int getMinErrorChangeIterationsCount()
public ErrorFunction getErrorFunction()
public void setErrorFunction(ErrorFunction errorFunction)
public double getTotalNetworkError()
Copyright © 2019 Neuroph Project. All rights reserved.