feedforward.setInputNeurons(dialog.getInputCount().getValue());
feedforward.setOutputNeurons(dialog.getOutputCount().getValue());
BasicNetwork obj = (BasicNetwork) feedforward.generate();
} else {
// try to prune it
PruneSelective prune = new PruneSelective(network);
int newInputCount = dialog.getInputCount().getValue();
int newOutputCount = dialog.getOutputCount().getValue();
// did input neurons change?
if (newInputCount != network.getInputCount()) {
prune.changeNeuronCount(0, newInputCount);
}
// did output neurons change?
if (newOutputCount != network.getOutputCount()) {
prune.changeNeuronCount(0, newOutputCount);
}
// did the hidden layers change?
for (int i = 0; i < network.getLayerCount() - 2; i++) {
int newHiddenCount = 1;
String str = (String) dialog.getHidden().getModel()
.getElementAt(i);
int i1 = str.indexOf(':');
int i2 = str.indexOf("neur");
if (i1 != -1 && i2 != -1) {
str = str.substring(i1 + 1, i2).trim();
newHiddenCount = Integer.parseInt(str);
}
// did this hidden layer change?
if (network.getLayerNeuronCount(i) != newHiddenCount) {
prune.changeNeuronCount(i + 1, newHiddenCount);
}
}
}
setDirty(true);
produceReport();