code: 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;
      }
docs: 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 randomness
  @return the score value in terms of cross validated error