use of de.unidue.ltl.evaluation.measures.Accuracy in project dkpro-tc by dkpro.
the class MultiSvmDocumentClassificationUsingWekaLibsvmLiblinearTest method getAccuracy.
private double getAccuracy(List<File> id2outcomeFiles, String simpleName) throws Exception {
for (File f : id2outcomeFiles) {
if (f.getAbsolutePath().toLowerCase().contains(simpleName.toLowerCase())) {
EvaluationData<String> data = Tc2LtlabEvalConverter.convertSingleLabelModeId2Outcome(f);
Accuracy<String> acc = new Accuracy<>(data);
return acc.getResult();
}
}
return -1;
}
use of de.unidue.ltl.evaluation.measures.Accuracy in project dkpro-tc by dkpro.
the class LiblinearDocumentPlainTest method getAccuracy.
private double getAccuracy(List<File> id2outcomeFiles, String simpleName) throws Exception {
for (File f : id2outcomeFiles) {
if (f.getAbsolutePath().toLowerCase().contains(simpleName.toLowerCase())) {
EvaluationData<String> data = Tc2LtlabEvalConverter.convertSingleLabelModeId2Outcome(f);
Accuracy<String> acc = new Accuracy<>(data);
return acc.getResult();
}
}
return -1;
}
use of de.unidue.ltl.evaluation.measures.Accuracy in project dkpro-tc by dkpro.
the class MultiSvmDocumentClassificationUsingWekaLibsvmLiblinearTest method getAccuracyCrossValidation.
private double getAccuracyCrossValidation(List<File> id2outcomeFiles, String simpleName) throws Exception {
for (File f : id2outcomeFiles) {
File file = new File(f.getParentFile(), "ATTRIBUTES.txt");
Set<String> readSubTasks = readSubTasks(file);
for (String k : readSubTasks) {
File file2 = new File(f.getParentFile().getParentFile() + "/" + k, "ATTRIBUTES.txt");
if (!file2.exists()) {
continue;
}
Set<String> readSubTasks2 = readSubTasks(file2);
for (String j : readSubTasks2) {
if (j.toLowerCase().contains(simpleName.toLowerCase())) {
EvaluationData<String> data = Tc2LtlabEvalConverter.convertSingleLabelModeId2Outcome(f);
Accuracy<String> acc = new Accuracy<>(data);
return acc.getResult();
}
}
}
}
return -1;
}
use of de.unidue.ltl.evaluation.measures.Accuracy in project dkpro-tc by dkpro.
the class LibsvmDocumentPlainTest method getAccuracy.
private double getAccuracy(List<File> id2outcomeFiles, String simpleName) throws Exception {
for (File f : id2outcomeFiles) {
if (f.getAbsolutePath().toLowerCase().contains(simpleName.toLowerCase())) {
EvaluationData<String> data = Tc2LtlabEvalConverter.convertSingleLabelModeId2Outcome(f);
Accuracy<String> acc = new Accuracy<>(data);
return acc.getResult();
}
}
return -1;
}
use of de.unidue.ltl.evaluation.measures.Accuracy in project dkpro-tc by dkpro.
the class SVMHMMBrownPosDemoTest method testSvmHmm.
@Test
public void testSvmHmm() throws Exception {
pSpace = SvmHmmBrownPosDemo.getParameterSpace();
javaExperiment.runTrainTest(pSpace);
File inputFile = ContextMemoryReport.id2outcomeFiles.get(0);
EvaluationData<String> data = Tc2LtlabEvalConverter.convertSingleLabelModeId2Outcome(pathVerification(inputFile));
Accuracy<String> acc = new Accuracy<String>(data);
assertEquals(0.3, acc.getResult(), 0.2);
assertEquals(1, ContextMemoryReport.id2outcomeFiles.size());
List<String> lines = FileUtils.readLines(ContextMemoryReport.id2outcomeFiles.get(0), "utf-8");
assertEquals(34, lines.size());
// line-wise compare
assertEquals("#ID=PREDICTION;GOLDSTANDARD;THRESHOLD", lines.get(0));
assertEquals("#labels 1=ABX 2=AP 3=AT 4=BEDZ 5=BEN 6=BER 7=CC 8=CS 9=DOD 10=DT 11=DTS 12=HV 13=HVD 14=IN 15=JJ 16=JJT 17=MD 18=NN 19=NNS 20=NP 21=NPg 22=PPO 23=PPS 24=QL 25=RB 26=TO 27=VB 28=VBD 29=VBG 30=VBN 31=WDT 32=pct", lines.get(1));
assertTrue(lines.get(3).matches("0=[0-9]+;7;-1"));
assertTrue(lines.get(4).matches("1=[0-9]+;2;-1"));
assertTrue(lines.get(5).matches("10=[0-9]+;32;-1"));
assertTrue(lines.get(6).matches("11=[0-9]+;17;-1"));
assertTrue(lines.get(7).matches("12=[0-9]+;27;-1"));
assertTrue(lines.get(8).matches("13=[0-9]+;19;-1"));
assertTrue(lines.get(9).matches("14=[0-9]+;32;-1"));
assertTrue(lines.get(10).matches("15=[0-9]+;18;-1"));
assertTrue(lines.get(11).matches("16=[0-9]+;19;-1"));
assertTrue(lines.get(12).matches("17=[0-9]+;32;-1"));
assertTrue(lines.get(13).matches("18=[0-9]+;18;-1"));
assertTrue(lines.get(14).matches("19=[0-9]+;19;-1"));
assertTrue(lines.get(15).matches("2=[0-9]+;19;-1"));
assertTrue(lines.get(16).matches("20=[0-9]+;18;-1"));
assertTrue(lines.get(17).matches("21=[0-9]+;32;-1"));
assertTrue(lines.get(18).matches("22=[0-9]+;3;-1"));
}
Aggregations