result.setInfo("Dataset",MLUtils.getDatasetName(D)); result.setInfo("Verbosity",Vop); if (h instanceof MultiTargetClassifier || Evaluation.isMT(D)) { result.setInfo("Type","MT");
result.setInfo("Dataset",MLUtils.getDatasetName(D)); result.setInfo("Verbosity",Vop); if (h instanceof MultiTargetClassifier || Evaluation.isMT(D)) { result.setInfo("Type","MT");
/** * EvaluateModel - Assume 'h' is already built, test it on 'D_test', threshold it according to 'top', verbosity 'vop'. * @param h a multi-dim. classifier * @param D_test test data * @param tal Threshold VALUES (not option) * @param vop Verbosity OPtion (which measures do we want to calculate/output) * @return Result raw prediction data with evaluation statistics included. */ public static Result evaluateModel(MultiXClassifier h, Instances D_test, String tal, String vop) throws Exception { Result r = testClassifier(h,D_test); if (h instanceof MultiTargetClassifier || isMT(D_test)) { r.setInfo("Type","MT"); } else if (h instanceof MultiLabelClassifier) { r.setInfo("Type","ML"); } r.setInfo("Threshold",tal); r.setInfo("Verbosity",vop); r.output = Result.getStats(r, vop); return r; }
/** * EvaluateModel - Assume 'h' is already built, test it on 'D_test', threshold it according to 'top', verbosity 'vop'. * @param h a multi-dim. classifier * @param D_test test data * @param tal Threshold VALUES (not option) * @param vop Verbosity OPtion (which measures do we want to calculate/output) * @return Result raw prediction data with evaluation statistics included. */ public static Result evaluateModel(MultiXClassifier h, Instances D_test, String tal, String vop) throws Exception { Result r = testClassifier(h,D_test); if (h instanceof MultiTargetClassifier || isMT(D_test)) { r.setInfo("Type","MT"); } else if (h instanceof MultiLabelClassifier) { r.setInfo("Type","ML"); } r.setInfo("Threshold",tal); r.setInfo("Verbosity",vop); r.output = Result.getStats(r, vop); return r; }
/** * EvaluateModel - Build model 'h' on 'D_train', test it on 'D_test', threshold it according to 'top', verbosity 'vop'. * @param h a multi-dim. classifier * @param D_train training data * @param D_test test data * @param top Threshold OPtion (pertains to multi-label data only) * @param vop Verbosity OPtion (which measures do we want to calculate/output) * @return Result raw prediction data with evaluation statistics included. */ public static Result evaluateModel(MultiXClassifier h, Instances D_train, Instances D_test, String top, String vop) throws Exception { Result r = evaluateModel(h,D_train,D_test); if (h instanceof MultiTargetClassifier || isMT(D_test)) { r.setInfo("Type","MT"); } else if (h instanceof MultiLabelClassifier) { r.setInfo("Type","ML"); r.setInfo("Threshold",MLEvalUtils.getThreshold(r.predictions,D_train,top)); // <-- only relevant to ML (for now), but we'll put it in here in any case } r.setInfo("Verbosity",vop); r.output = Result.getStats(r, vop); return r; }
/** * EvaluateModel - Build model 'h' on 'D_train', test it on 'D_test', threshold it according to 'top', verbosity 'vop'. * @param h a multi-dim. classifier * @param D_train training data * @param D_test test data * @param top Threshold OPtion (pertains to multi-label data only) * @param vop Verbosity OPtion (which measures do we want to calculate/output) * @return Result raw prediction data with evaluation statistics included. */ public static Result evaluateModel(MultiXClassifier h, Instances D_train, Instances D_test, String top, String vop) throws Exception { Result r = evaluateModel(h,D_train,D_test); if (h instanceof MultiTargetClassifier || isMT(D_test)) { r.setInfo("Type","MT"); } else if (h instanceof MultiLabelClassifier) { r.setInfo("Type","ML"); r.setInfo("Threshold",MLEvalUtils.getThreshold(r.predictions,D_train,top)); // <-- only relevant to ML (for now), but we'll put it in here in any case } r.setInfo("Verbosity",vop); r.output = Result.getStats(r, vop); return r; }
if (h instanceof MultiTargetClassifier || isMT(D_test)) { result.setInfo("Type","MT");
if (h instanceof MultiTargetClassifier || isMT(D_test)) { result.setInfo("Type","MT");
if (h instanceof MultiTargetClassifier || isMT(D)) { r.setInfo("Type","MT-CV");
/** * Test classifier h, on dataset D, under super-class partition 'partition'. * <br> * TODO should be able to use something out of meka.classifiers.Evaluation instead of all this ... */ public Result testClassifier(Classifier h, Instances D_train, Instances D_test, int partition[][]) throws Exception { trainClassifier(m_Classifier,D_train,partition); Result result = Evaluation.testClassifier((ProblemTransformationMethod)h, D_test); if (h instanceof MultiTargetClassifier || Evaluation.isMT(D_test)) { result.setInfo("Type","MT"); } else if (h instanceof ProblemTransformationMethod) { result.setInfo("Threshold", MLEvalUtils.getThreshold(result.predictions, D_train, "PCut1")); result.setInfo("Type","ML"); } result.setValue("N_train",D_train.numInstances()); result.setValue("N_test",D_test.numInstances()); result.setValue("LCard_train",MLUtils.labelCardinality(D_train)); result.setValue("LCard_test",MLUtils.labelCardinality(D_test)); //result.setValue("Build_time",(after - before)/1000.0); //result.setValue("Test_time",(after_test - before_test)/1000.0); //result.setValue("Total_time",(after_test - before)/1000.0); result.setInfo("Classifier_name",h.getClass().getName()); //result.setInfo("Classifier_ops", Arrays.toString(h.getOptions())); result.setInfo("Classifier_info",h.toString()); result.setInfo("Dataset_name",MLUtils.getDatasetName(D_test)); result.output = Result.getStats(result,"1"); return result; }
/** * Test classifier h, on dataset D, under super-class partition 'partition'. * <br> * TODO should be able to use something out of meka.classifiers.Evaluation instead of all this ... */ public Result testClassifier(Classifier h, Instances D_train, Instances D_test, int partition[][]) throws Exception { trainClassifier(m_Classifier,D_train,partition); Result result = Evaluation.testClassifier((ProblemTransformationMethod)h, D_test); if (h instanceof MultiTargetClassifier || Evaluation.isMT(D_test)) { result.setInfo("Type","MT"); } else if (h instanceof ProblemTransformationMethod) { result.setInfo("Threshold", MLEvalUtils.getThreshold(result.predictions, D_train, "PCut1")); result.setInfo("Type","ML"); } result.setValue("N_train",D_train.numInstances()); result.setValue("N_test",D_test.numInstances()); result.setValue("LCard_train",MLUtils.labelCardinality(D_train)); result.setValue("LCard_test",MLUtils.labelCardinality(D_test)); //result.setValue("Build_time",(after - before)/1000.0); //result.setValue("Test_time",(after_test - before_test)/1000.0); //result.setValue("Total_time",(after_test - before)/1000.0); result.setInfo("Classifier_name",h.getClass().getName()); //result.setInfo("Classifier_ops", Arrays.toString(h.getOptions())); result.setInfo("Classifier_info",h.toString()); result.setInfo("Dataset_name",MLUtils.getDatasetName(D_test)); result.output = Result.getStats(result,"1"); return result; }
if (h instanceof MultiTargetClassifier || isMT(D)) { r.setInfo("Type","MT-CV");