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.
Exemple #1
0
        /// <summary>
        /// Create an instance of competitive training.
        /// </summary>
        /// <param name="network">The network to train.</param>
        /// <param name="learningRate">The learning rate, how much to apply per iteration.</param>
        /// <param name="training">The training set (unsupervised).</param>
        /// <param name="neighborhood">The neighborhood function to use.</param>
        public CompetitiveTraining(BasicNetwork network,
                                   double learningRate, INeuralDataSet training,
                                   INeighborhoodFunction neighborhood)
        {
            this.neighborhood = neighborhood;
            Training          = training;
            this.LearningRate = learningRate;
            this.network      = network;
            this.inputLayer   = network.GetLayer(BasicNetwork.TAG_INPUT);
            this.outputLayer  = network.GetLayer(BasicNetwork.TAG_OUTPUT);
            this.synapses     = network.Structure.GetPreviousSynapses(
                this.outputLayer);
            this.inputNeuronCount  = this.inputLayer.NeuronCount;
            this.outputNeuronCount = this.outputLayer.NeuronCount;
            this.ForceWinner       = false;
            Error = 0;

            // setup the correction matrix
            foreach (ISynapse synapse in this.synapses)
            {
                Matrix matrix = new Matrix(synapse.WeightMatrix.Rows,
                                           synapse.WeightMatrix.Cols);
                this.correctionMatrix[synapse] = matrix;
            }

            // create the BMU class
            this.bmuUtil = new BestMatchingUnit(this);
        }
        /// <summary>
        /// Create an instance of competitive training.
        /// </summary>
        /// <param name="network">The network to train.</param>
        /// <param name="learningRate">The learning rate, how much to apply per iteration.</param>
        /// <param name="training">The training set (unsupervised).</param>
        /// <param name="neighborhood">The neighborhood function to use.</param>
        public CompetitiveTraining(BasicNetwork network,
                 double learningRate, INeuralDataSet training,
                 INeighborhoodFunction neighborhood)
        {
            this.neighborhood = neighborhood;
            Training = training;
            this.LearningRate = learningRate;
            this.network = network;
            this.inputLayer = network.GetLayer(BasicNetwork.TAG_INPUT);
            this.outputLayer = network.GetLayer(BasicNetwork.TAG_OUTPUT);
            this.synapses = network.Structure.GetPreviousSynapses(
                    this.outputLayer);
            this.inputNeuronCount = this.inputLayer.NeuronCount;
            this.outputNeuronCount = this.outputLayer.NeuronCount;
            this.ForceWinner = false;
            Error = 0;

            // setup the correction matrix
            foreach (ISynapse synapse in this.synapses)
            {
                Matrix matrix = new Matrix(synapse.WeightMatrix.Rows,
                       synapse.WeightMatrix.Cols);
                this.correctionMatrix[synapse] = matrix;
            }

            // create the BMU class
            this.bmuUtil = new BestMatchingUnit(this);
        }