current.train(targetError, verbose);
if (verbose) {System.out.println("test MSE: " + current.getError(testset));};
} while (current.getError(testset) > selectionError);
}
if(aggregator.needsTraining()) {
EnsembleDataSet aggTrainingSet = new EnsembleDataSet(members.size() * aggregatorDataSet.getIdealSize(),aggregatorDataSet.getIdealSize());
for (MLDataPair trainingInput:aggregatorDataSet) {
BasicMLData trainingInstance = new BasicMLData(members.size() * aggregatorDataSet.getIdealSize());
int index = 0;
for(EnsembleML member:members){
for(double val:member.compute(trainingInput.getInput()).getData()) {
trainingInstance.add(index++, val);
}
}
aggTrainingSet.add(trainingInstance,trainingInput.getIdeal());
}
aggregator.setTrainingSet(aggTrainingSet);
aggregator.train();
}
}