The score function for a data set and a learner by cross validation of a classifier @param workOn the transformed data set to test from with cross validation @param evaluater the learning algorithm to use @param folds the number of cross validation folds to perform @param rand the source of randomn
(DataSet workOn, Object evaluater, int folds, Random rand)
| 307 | * @return the score value in terms of cross validated error |
| 308 | */ |
| 309 | protected static double getScore(DataSet workOn, Object evaluater, int folds, Random rand) |
| 310 | { |
| 311 | if(workOn instanceof ClassificationDataSet) |
| 312 | { |
| 313 | ClassificationModelEvaluation cme = |
| 314 | new ClassificationModelEvaluation((Classifier)evaluater, |
| 315 | (ClassificationDataSet)workOn); |
| 316 | cme.evaluateCrossValidation(folds, rand); |
| 317 | |
| 318 | return cme.getErrorRate(); |
| 319 | } |
| 320 | else if(workOn instanceof RegressionDataSet) |
| 321 | { |
| 322 | RegressionModelEvaluation rme = |
| 323 | new RegressionModelEvaluation((Regressor)evaluater, |
| 324 | (RegressionDataSet)workOn); |
| 325 | rme.evaluateCrossValidation(folds, rand); |
| 326 | |
| 327 | return rme.getMeanError(); |
| 328 | } |
| 329 | return Double.POSITIVE_INFINITY; |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * Sets the maximum allowable the maximum tolerable increase in error when a |
no test coverage detected