* Contains information about the job unit.
*/
@Override
public final void performJobUnit(final JobUnitContext context) {
final BasicNetwork network = (BasicNetwork) context.getJobUnit();
BufferedNeuralDataSet buffer = null;
MLDataSet useTraining = this.training;
if (this.training instanceof BufferedNeuralDataSet) {
buffer = (BufferedNeuralDataSet) this.training;
useTraining = buffer.openAdditional();
}
// train the neural network
double error = Double.POSITIVE_INFINITY;
for (int z = 0; z < this.weightTries; z++) {
network.reset();
final Propagation train = new ResilientPropagation(network,
useTraining);
final StopTrainingStrategy strat = new StopTrainingStrategy(0.001,
5);
train.addStrategy(strat);
train.setNumThreads(1); // force single thread mode
for (int i = 0; (i < this.iterations) && !getShouldStop()
&& !strat.shouldStop(); i++) {
train.iteration();
}
error = Math.min(error, train.getError());
}
if (buffer != null) {
buffer.close();
}
if (!getShouldStop()) {
// update min and max
this.high = Math.max(this.high, error);
this.low = Math.min(this.low, error);
if (this.hidden1Size > 0) {
int networkHidden1Count;
int networkHidden2Count;
if (network.getLayerCount() > 3) {
networkHidden2Count = network.getLayerNeuronCount(1);
networkHidden1Count = network.getLayerNeuronCount(2);
} else {
networkHidden2Count = 0;
networkHidden1Count = network.getLayerNeuronCount(1);
}
int row, col;
if (this.hidden2Size == 0) {