|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.encog.ml.train.BasicTraining
org.encog.neural.som.training.basic.BasicTrainSOM
public class BasicTrainSOM
This class implements competitive training, which would be used in a winner-take-all neural network, such as the self organizing map (SOM). This is an unsupervised training method, no ideal data is needed on the training set. If ideal data is provided, it will be ignored. Training is done by looping over all of the training elements and calculating a "best matching unit" (BMU). This BMU output neuron is then adjusted to better "learn" this pattern. Additionally, this training may be applied to other "nearby" output neurons. The degree to which nearby neurons are update is defined by the neighborhood function. A neighborhood function is required to determine the degree to which neighboring neurons (to the winning neuron) are updated by each training iteration. Because this is unsupervised training, calculating an error to measure progress by is difficult. The error is defined to be the "worst", or longest, Euclidean distance of any of the BMU's. This value should be minimized, as learning progresses. Because only the BMU neuron and its close neighbors are updated, you can end up with some output neurons that learn nothing. By default these neurons are not forced to win patterns that are not represented well. This spreads out the workload among all output neurons. This feature is not used by default, but can be enabled by setting the "forceWinner" property.
Constructor Summary | |
---|---|
BasicTrainSOM(SOM network,
double learningRate,
MLDataSet training,
NeighborhoodFunction neighborhood)
Create an instance of competitive training. |
Method Summary | |
---|---|
void |
autoDecay()
Should be called each iteration if autodecay is desired. |
boolean |
canContinue()
|
void |
decay(double d)
Called to decay the learning rate and radius by the specified amount. |
void |
decay(double decayRate,
double decayRadius)
Decay the learning rate and radius by the specified amount. |
int |
getInputNeuronCount()
|
double |
getLearningRate()
|
MLMethod |
getMethod()
Get the current best machine learning method from the training. |
NeighborhoodFunction |
getNeighborhood()
|
int |
getOutputNeuronCount()
|
boolean |
isForceWinner()
|
void |
iteration()
Perform one training iteration. |
TrainingContinuation |
pause()
Pause the training to continue later. |
void |
resume(TrainingContinuation state)
Resume training. |
void |
setAutoDecay(int plannedIterations,
double startRate,
double endRate,
double startRadius,
double endRadius)
Setup autodecay. |
void |
setForceWinner(boolean forceWinner)
Determine if a winner is to be forced. |
void |
setLearningRate(double rate)
Set the learning rate. |
void |
setParams(double rate,
double radius)
Set the learning rate and radius. |
String |
toString()
|
void |
trainPattern(MLData pattern)
Train the specified pattern. |
Methods inherited from class org.encog.ml.train.BasicTraining |
---|
addStrategy, finishTraining, getError, getImplementationType, getIteration, getStrategies, getTraining, isTrainingDone, iteration, postIteration, preIteration, setError, setIteration, setTraining |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BasicTrainSOM(SOM network, double learningRate, MLDataSet training, NeighborhoodFunction neighborhood)
network
- The network to train.learningRate
- The learning rate, how much to apply per iteration.training
- The training set (unsupervised).neighborhood
- The neighborhood function to use.Method Detail |
---|
public void autoDecay()
public boolean canContinue()
canContinue
in interface MLTrain
public void decay(double d)
d
- The percent to decay by.public void decay(double decayRate, double decayRadius)
decayRate
- The percent to decay the learning rate by.decayRadius
- The percent to decay the radius by.public int getInputNeuronCount()
public double getLearningRate()
getLearningRate
in interface LearningRate
public MLMethod getMethod()
getMethod
in interface MLTrain
public NeighborhoodFunction getNeighborhood()
public int getOutputNeuronCount()
public boolean isForceWinner()
public void iteration()
iteration
in interface MLTrain
public TrainingContinuation pause()
pause
in interface MLTrain
public void resume(TrainingContinuation state)
resume
in interface MLTrain
state
- The training continuation object to use to continue.public void setAutoDecay(int plannedIterations, double startRate, double endRate, double startRadius, double endRadius)
plannedIterations
- The number of iterations that are planned. This allows the
decay rate to be determined.startRate
- The starting learning rate.endRate
- The ending learning rate.startRadius
- The starting radius.endRadius
- The ending radius.public void setForceWinner(boolean forceWinner)
forceWinner
- True if a winner is to be forced.public void setLearningRate(double rate)
setLearningRate
in interface LearningRate
rate
- The learning rate.public void setParams(double rate, double radius)
rate
- The new learning rate.radius
- The new radius.public String toString()
toString
in class Object
public void trainPattern(MLData pattern)
pattern
- The pattern to train.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |