ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1561705 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java
Date Mon, 27 Jan 2014 15:14:34 GMT
Author: clin
Date: Mon Jan 27 15:14:34 2014
New Revision: 1561705

URL: http://svn.apache.org/r1561705
Log:
Enable event properties evaluation models to be trained on both training and developing data,
test on the testing data, with "--test" option.

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java?rev=1561705&r1=1561704&r2=1561705&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java
Mon Jan 27 15:14:34 2014
@@ -20,6 +20,7 @@ package org.apache.ctakes.temporal.eval;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -69,6 +70,17 @@ public class EvaluationOfEventProperties
     List<Integer> patientSets = options.getPatients().getList();
     List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
     List<Integer> devItems = THYMEData.getDevPatientSets(patientSets);
+    List<Integer> testItems = THYMEData.getTestPatientSets(patientSets);
+    
+    List<Integer> allTraining = new ArrayList<Integer>(trainItems);
+    List<Integer> allTest = null;
+    if(options.getTest()){
+      allTraining.addAll(devItems);
+      allTest = new ArrayList<Integer>(testItems);
+    }else{
+      allTest = new ArrayList<Integer>(devItems);
+    }
+    
     EvaluationOfEventProperties evaluation = new EvaluationOfEventProperties(
         new File("target/eval/event-properties"),
         options.getRawTextDirectory(),
@@ -77,7 +89,7 @@ public class EvaluationOfEventProperties
         options.getXMIDirectory());
     evaluation.prepareXMIsFor(patientSets);
     evaluation.logClassificationErrors(new File("target/eval"), "ctakes-event-property-errors");
-    Map<String, AnnotationStatistics<String>> stats = evaluation.trainAndTest(trainItems,
devItems);
+    Map<String, AnnotationStatistics<String>> stats = evaluation.trainAndTest(allTraining,
allTest);
     for (String name : PROPERTY_NAMES) {
       System.err.println("====================");
       System.err.println(name);



Mime
View raw message