org.encog.neural.som.training.basic
Class BestMatchingUnit
- java.lang.Object
-
- org.encog.neural.som.training.basic.BestMatchingUnit
-
public class BestMatchingUnit extends java.lang.ObjectThe "Best Matching Unit" or BMU is a very important concept in the training for a SOM. The BMU is the output neuron that has weight connections to the input neurons that most closely match the current input vector. This neuron (and its "neighborhood") are the neurons that will receive training. This class also tracks the worst distance (of all BMU's). This gives some indication of how well the network is trained, and thus becomes the "error" of the entire network.
-
-
Constructor Summary
Constructors Constructor and Description BestMatchingUnit(SOM som)Construct a BestMatchingUnit class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcalculateBMU(MLData input)Calculate the best matching unit (BMU).doublecalculateEuclideanDistance(Matrix matrix, MLData input, int outputNeuron)Calculate the Euclidean distance for the specified output neuron and the input vector.doublegetWorstDistance()voidreset()Reset the "worst distance" back to a minimum value.
-
-
-
Constructor Detail
-
BestMatchingUnit
public BestMatchingUnit(SOM som)
Construct a BestMatchingUnit class. The training class must be provided.- Parameters:
som- The SOM to evaluate.
-
-
Method Detail
-
calculateBMU
public int calculateBMU(MLData input)
Calculate the best matching unit (BMU). This is the output neuron that has the lowest Euclidean distance to the input vector.- Parameters:
input- The input vector.- Returns:
- The output neuron number that is the BMU.
-
calculateEuclideanDistance
public double calculateEuclideanDistance(Matrix matrix, MLData input, int outputNeuron)
Calculate the Euclidean distance for the specified output neuron and the input vector. This is the square root of the squares of the differences between the weight and input vectors.- Parameters:
matrix- The matrix to get the weights from.input- The input vector.outputNeuron- The neuron we are calculating the distance for.- Returns:
- The Euclidean distance.
-
getWorstDistance
public double getWorstDistance()
- Returns:
- What is the worst BMU distance so far, this becomes the error for the entire SOM.
-
reset
public void reset()
Reset the "worst distance" back to a minimum value. This should be called for each training iteration.
-
-
DMelt 3.0 © DataMelt by jWork.ORG