Changeset 113


Ignore:
Timestamp:
05/27/16 17:10:29 (8 years ago)
Author:
atrautsch
Message:

fix gpv

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/training/GPTraining.java

    r112 r113  
    503503                    } 
    504504                } 
    505                  
    506                  
     505 
    507506                // now after the evaluation we do a model selection where only one model remains for the given training data 
    508507                // we select the model which is best on all evaluation data 
     
    652651                } 
    653652                 
    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 
    657655                double smallest_error_count = Double.MAX_VALUE; 
    658656                double[] errors; 
    659657                Classifier best = null; 
    660658                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 
    661662                    for(int j=0; j < traindataSet.size(); j++) { 
    662663                        if(j != i) { 
    663664                            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]; 
    668667                        } 
    669668                    } 
    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                 
    671677                 
    672678                // now we have the best classifier for this training data 
    673679                classifiers.add(best); 
     680 
    674681            } /* endfor trainData */ 
    675682             
Note: See TracChangeset for help on using the changeset viewer.