Changeset 125 for trunk/CrossPare/src/de/ugoe/cs
- Timestamp:
- 06/08/16 10:02:55 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/training/GPTraining.java
r113 r125 484 484 485 485 // number of runs, yields the best of these 486 double smallest_error_count_train = Double.MAX_VALUE; 487 Classifier bestTrain = null; 486 488 for(int k=0; k < this.numberRuns; k++) { 489 double[] errors_eval = {0.0, 0.0}; 487 490 Classifier classifier = new GPRun(); 488 491 ((GPRun)classifier).configure(this.populationSize, this.initMinDepth, this.initMaxDepth, this.tournamentSize, this.maxGenerations, this.errorType2Weight, this.maxDepth, this.maxNodes); … … 497 500 // if type1 and type2 errors are < 0.5 we allow the model in the candidates 498 501 errors = this.evaluate((GPRun)classifier, traindataSet.get(j)); 502 errors_eval[0] += errors[0]; 503 errors_eval[1] += errors[1]; 499 504 if((errors[0] < 0.5) && (errors[1] < 0.5)) { 500 505 candidates.add(classifier); 501 506 } 502 507 } 508 } 509 510 // if the candidate made fewer errors it is now the best 511 if(errors_eval[0] + errors_eval[1] < smallest_error_count_train) { 512 bestTrain = classifier; 513 smallest_error_count_train = errors_eval[0] + errors_eval[1]; 503 514 } 504 515 } … … 528 539 } 529 540 530 541 if( best==null ) { 542 best = bestTrain; 543 } 531 544 // now we have the best classifier for this training data 532 545 classifiers.add(best);
Note: See TracChangeset
for help on using the changeset viewer.