use of de.unidue.ltl.evaluation.measures.correlation.SpearmanCorrelation in project dkpro-tc by dkpro.
the class KerasRegressionCrossValidation method runTest.
@Test
public void runTest() throws Exception {
DemoUtils.setDkproHome(KerasRegressionWassa.class.getSimpleName());
boolean testConditon = true;
String python3 = null;
try {
python3 = getEnvironment();
} catch (Exception e) {
System.err.println("Failed to locate Python with Keras - will skip this test case");
testConditon = false;
}
if (testConditon) {
ParameterSpace ps = KerasRegression.getParameterSpace(python3);
KerasRegression.runCrossValidation(ps);
EvaluationData<Double> data = Tc2LtlabEvalConverter.convertRegressionModeId2Outcome(ContextMemoryReport.crossValidationCombinedIdFiles.get(0));
SpearmanCorrelation spear = new SpearmanCorrelation(data);
assertTrue(spear.getResult() < 0.0);
}
}
use of de.unidue.ltl.evaluation.measures.correlation.SpearmanCorrelation in project dkpro-tc by dkpro.
the class MetricComputationUtil method getResults.
public static Map<String, String> getResults(File id2o, String mode) throws Exception {
if (mode == null) {
throw new IllegalArgumentException("The learning mode is null");
}
Map<String, String> map = new HashMap<>();
if (mode.equals(Constants.LM_SINGLE_LABEL)) {
EvaluationData<String> data = Tc2LtlabEvalConverter.convertSingleLabelModeId2Outcome(id2o);
Accuracy<String> acc = new Accuracy<>(data);
map.put(acc.getClass().getSimpleName(), "" + acc.getResult());
} else if (mode.equals(Constants.LM_REGRESSION)) {
EvaluationData<Double> data = Tc2LtlabEvalConverter.convertRegressionModeId2Outcome(id2o);
EvaluationMeasure<?> m = new RSquared(data);
map.put(m.getClass().getSimpleName(), getExceptionFreeResult(m));
m = new PearsonCorrelation(data);
map.put(m.getClass().getSimpleName(), getExceptionFreeResult(m));
m = new SpearmanCorrelation(data);
map.put(m.getClass().getSimpleName(), getExceptionFreeResult(m));
m = new MeanSquaredError(data);
map.put(m.getClass().getSimpleName(), getExceptionFreeResult(m));
m = new MeanAbsoluteError(data);
map.put(m.getClass().getSimpleName(), getExceptionFreeResult(m));
} else if (mode.equals(Constants.LM_MULTI_LABEL)) {
EvaluationData<String> data = Tc2LtlabEvalConverter.convertMultiLabelModeId2Outcome(id2o);
EvaluationMeasure<?> m = new ExactMatchRatio<>(data);
map.put(m.getClass().getSimpleName(), getExceptionFreeResult(m));
EvaluationData<Integer> dataInt = Tc2LtlabEvalConverter.convertMultiLabelModeId2OutcomeUseInteger(id2o);
m = new HammingLoss(dataInt);
map.put(m.getClass().getSimpleName(), getExceptionFreeResult(m));
m = new MultilabelAccuracy(dataInt);
map.put(m.getClass().getSimpleName(), getExceptionFreeResult(m));
}
return map;
}
Aggregations