- Timestamp:
- 05/27/16 17:10:29 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/training/GPTraining.java
r112 r113 503 503 } 504 504 } 505 506 505 507 506 // now after the evaluation we do a model selection where only one model remains for the given training data 508 507 // we select the model which is best on all evaluation data … … 652 651 } 653 652 654 // after the numberRuns we have < numberRuns candidate models for this trainData 655 // we now evaluate the candidates 656 // finding the best model is not really described in the paper we go with least errors 653 // now after the evaluation we do a model selection where only one model remains for the given training data 654 // we select the model which is best on all evaluation data 657 655 double smallest_error_count = Double.MAX_VALUE; 658 656 double[] errors; 659 657 Classifier best = null; 660 658 for(int ii=0; ii < candidates.size(); ii++) { 659 double[] errors_eval = {0.0, 0.0}; 660 661 // we add the errors the candidate makes over the evaldata 661 662 for(int j=0; j < traindataSet.size(); j++) { 662 663 if(j != i) { 663 664 errors = this.evaluate((GPRun)candidates.get(ii), traindataSet.get(j)); 664 665 if(errors[0]+errors[1] < smallest_error_count) { 666 best = candidates.get(ii); 667 } 665 errors_eval[0] += errors[0]; 666 errors_eval[1] += errors[1]; 668 667 } 669 668 } 670 } 669 670 // if the candidate made fewer errors it is now the best 671 if(errors_eval[0] + errors_eval[1] < smallest_error_count) { 672 best = candidates.get(ii); 673 smallest_error_count = errors_eval[0] + errors_eval[1]; 674 } 675 } 676 671 677 672 678 // now we have the best classifier for this training data 673 679 classifiers.add(best); 680 674 681 } /* endfor trainData */ 675 682
Note: See TracChangeset
for help on using the changeset viewer.