// create the training set
final MLDataSet training = new BasicMLDataSet(
TestCompetitive.SOM_INPUT, null);
// Create the neural network.
SOM network = new SOM(4,2);
network.setWeights(new Matrix(MATRIX_ARRAY));
final BasicTrainSOM train = new BasicTrainSOM(network, 0.4,
training, new NeighborhoodSingle());
train.setForceWinner(true);
int iteration = 0;
for (iteration = 0; iteration <= 100; iteration++) {
train.iteration();
}
final MLData data1 = new BasicMLData(
TestCompetitive.SOM_INPUT[0]);
final MLData data2 = new BasicMLData(
TestCompetitive.SOM_INPUT[1]);
int result1 = network.winner(data1);
int result2 = network.winner(data2);
Assert.assertTrue(result1!=result2);
}