}
/**
* Setup the scoring function.
*/
ScoreFunction score = new ScoreTitanic(training);
ScoreFunction scoreValidate = new ScoreTitanic(validation);
/**
* Setup particle swarm.
*/
boolean done = false;
TrainPSO train = new TrainPSO(particles, score);
int iterationNumber = 0;
StringBuilder line = new StringBuilder();
do {
iterationNumber++;
train.iteration();
RBFNetwork best = (RBFNetwork) train.getBestParticle();
double trainingScore = train.getLastError();
double validationScore = scoreValidate.calculateScore(best);
if (validationScore > bestScore) {
System.arraycopy(best.getLongTermMemory(), 0, this.bestNetwork.getLongTermMemory(), 0, best.getLongTermMemory().length);
this.bestScore = validationScore;
}