org.encog.neural.som.training.basic
Class BestMatchingUnit

java.lang.Object
  extended by org.encog.neural.som.training.basic.BestMatchingUnit

public class BestMatchingUnit
extends Object

The "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.

Author:
jeff

Constructor Summary
BestMatchingUnit(SOM som)
          Construct a BestMatchingUnit class.
 
Method Summary
 int calculateBMU(MLData input)
          Calculate the best matching unit (BMU).
 double calculateEuclideanDistance(Matrix matrix, MLData input, int outputNeuron)
          Calculate the Euclidean distance for the specified output neuron and the input vector.
 double getWorstDistance()
           
 void reset()
          Reset the "worst distance" back to a minimum value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.



Copyright © 2014. All Rights Reserved.