|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.encog.neural.networks.training.BasicTraining
org.encog.neural.networks.training.competitive.CompetitiveTraining
public class CompetitiveTraining
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 othr "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 | |
|---|---|
CompetitiveTraining(BasicNetwork network,
double learningRate,
NeuralDataSet training,
NeighborhoodFunction neighborhood)
Create an instance of competitive training. |
|
| Method Summary | |
|---|---|
void |
autoDecay()
Should be called each iteration if autodecay is desired. |
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()
|
NeighborhoodFunction |
getNeighborhood()
|
BasicNetwork |
getNetwork()
Get the current best network from the training. |
int |
getOutputNeuronCount()
|
boolean |
isForceWinner()
|
void |
iteration()
Perform one training iteration. |
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(NeuralData pattern)
Train the specified pattern. |
| Methods inherited from class org.encog.neural.networks.training.BasicTraining |
|---|
addStrategy, finishTraining, getCloud, getError, getIteration, getStrategies, getTraining, isTrainingDone, iteration, postIteration, preIteration, setCloud, setError, setIteration, setTraining |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CompetitiveTraining(BasicNetwork network,
double learningRate,
NeuralDataSet 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 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 LearningRatepublic NeighborhoodFunction getNeighborhood()
public BasicNetwork getNetwork()
Train
getNetwork in interface Trainpublic int getOutputNeuronCount()
public boolean isForceWinner()
public void iteration()
iteration in interface Train
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 LearningRaterate - 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 Objectpublic void trainPattern(NeuralData pattern)
pattern - The pattern to train.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||