// Reset the BMU and begin this iteration.
this.bmuUtil.reset();
final int[] won = new int[this.outputNeuronCount];
double leastRepresentedActivation = Double.MAX_VALUE;
MLData leastRepresented = null;
// Reset the correction matrix for this synapse and iteration.
this.correctionMatrix.clear();
// Determine the BMU for each training element.
for (final MLDataPair pair : getTraining()) {
final MLData input = pair.getInput();
final int bmu = this.bmuUtil.calculateBMU(input);
// If we are to force a winner each time, then track how many
// times each output neuron becomes the BMU (winner).
if (this.forceWinner) {
won[bmu]++;
// Get the "output" from the network for this pattern. This
// gets the activation level of the BMU.
final MLData output = this.network.compute(pair.getInput());
// Track which training entry produces the least BMU. This
// pattern is the least represented by the network.
if (output.getData(bmu) < leastRepresentedActivation) {
leastRepresentedActivation = output.getData(bmu);
leastRepresented = pair.getInput();
}
}
train(bmu, this.network.getWeights(), input);