protected static double getScore ( DataSet workOn , Object evaluater , int folds , Random rand ) { if ( workOn instanceof ClassificationDataSet ) { ClassificationModelEvaluation cme = new ClassificationModelEvaluation ( ( Classifier ) evaluater , ( ClassificationDataSet ) workOn ) ; cme . evaluateCrossValidation ( folds , rand ) ; return cme . getErrorRate ( ) ; } else if ( workOn instanceof RegressionDataSet ) { RegressionModelEvaluation rme = new RegressionModelEvaluation ( ( Regressor ) evaluater , ( RegressionDataSet ) workOn ) ; rme . evaluateCrossValidation ( folds , rand ) ; return rme . getMeanError ( ) ; } return Double . POSITIVE_INFINITY ; }
The score function for a data set and a learner by cross validation of a classifier