use of edu.cmu.minorthird.classify.algorithms.random.RandomElement in project lucida by claritylab.
the class ScoreNormalizationFilter method evaluate.
/**
* Performs a cross-validation on the given data set for the given features
* and model.
*
* @param serializedDir directory containing serialized results
* @param features selected features
* @param model selected model
* @return evaluation statistics
*/
public static Evaluation evaluate(String serializedDir, String[] features, String model) {
// create data set with selected features from serialized results
Dataset dataSet = createDataset(features, serializedDir);
// create learner for selected model
ClassifierLearner learner = createLearner(model);
// cross-validate model on data set
RandomElement r = new RandomElement(System.currentTimeMillis());
Splitter splitter = new CrossValSplitter(r, NUM_FOLDS);
CrossValidatedDataset cvDataset = new CrossValidatedDataset(learner, dataSet, splitter, true);
Evaluation eval = cvDataset.getEvaluation();
return eval;
}
use of edu.cmu.minorthird.classify.algorithms.random.RandomElement in project lucida by claritylab.
the class HierarchicalClassifierTrainer method runExperiment.
public Evaluation runExperiment() {
runTime = System.currentTimeMillis();
ClassifierLearner learner = createHierarchicalClassifierLearner(learnerNames);
if (crossValidationFolds < 0) {
evaluation = Tester.evaluate(learner, trainingSet, testingSet);
} else {
Splitter splitter = new CrossValSplitter(new RandomElement(System.currentTimeMillis()), crossValidationFolds);
cvDataset = new CrossValidatedDataset(learner, trainingSet, splitter, true);
evaluation = cvDataset.getEvaluation();
//remove later
//ViewerFrame frame=new ViewerFrame(trainingFile,cvDataset.toGUI());
//frame.setVisible(true);
//evaluation=Tester.evaluate(learner,trainingSet,splitter);
}
runTime = System.currentTimeMillis() - runTime;
return evaluation;
}
Aggregations