try {
final int inputNeuron = OCR.DOWNSAMPLE_HEIGHT
* OCR.DOWNSAMPLE_WIDTH;
final int outputNeuron = this.letterListModel.size();
final MLDataSet trainingSet = new BasicMLDataSet();
for (int t = 0; t < this.letterListModel.size(); t++) {
final MLData item = new BasicMLData(inputNeuron);
int idx = 0;
final SampleData ds = (SampleData) this.letterListModel
.getElementAt(t);
for (int y = 0; y < ds.getHeight(); y++) {
for (int x = 0; x < ds.getWidth(); x++) {
item.setData(idx++, ds.getData(x, y) ? .5 : -.5);
}
}
trainingSet.add(new BasicMLDataPair(item, null));
}
this.net = new SOM(inputNeuron,outputNeuron);
this.net.reset();