ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stevenbeth...@apache.org
Subject svn commit: r1627585 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal: data/analysis/ duration/ eval/ utils/
Date Thu, 25 Sep 2014 18:34:16 GMT
Author: stevenbethard
Date: Thu Sep 25 18:34:15 2014
New Revision: 1627585

URL: http://svn.apache.org/r1627585
Log:
Adds support for modifying the train/dev/test split from the command line. This is useful
for Clinical TempEval, where people only have access to the train data, but might want to
still use part of that as a dev set during development.

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintFailedTimeNormalizations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/RelationContextViewerPipeline.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/TimexTreeAlignmentStatistics.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventEventDurationStatistics.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventTimeDurationStatistics.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventProperties.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventSpans.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKTimeSpans.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventCoreference.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfNEPredicateEventSpans.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTemporalRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/THYMEData.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/RunCorpusDiagnostics.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/GoldRelationViewer.java
Thu Sep 25 18:34:15 2014
@@ -68,7 +68,7 @@ public class GoldRelationViewer {
 		Options options = CliFactory.parseArguments(Options.class, args);
 		
 		List<Integer> patientSets = options.getPatients().getList();
-		List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
+		List<Integer> trainItems = THYMEData.getPatientSets(patientSets, THYMEData.TRAIN_REMAINDERS);
 		List<File> trainFiles = Utils.getFilesFor(trainItems, options.getInputDirectory());
     CollectionReader collectionReader = Utils.getCollectionReader(trainFiles);
 		

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintFailedTimeNormalizations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintFailedTimeNormalizations.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintFailedTimeNormalizations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintFailedTimeNormalizations.java
Thu Sep 25 18:34:15 2014
@@ -65,7 +65,7 @@ public class PrintFailedTimeNormalizatio
   public static void main(String[] args) throws Exception {
     Options options = CliFactory.parseArguments(Options.class, args);
     List<Integer> patientSets = options.getPatients().getList();
-    List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
+    List<Integer> trainItems = THYMEData.getPatientSets(patientSets, THYMEData.TRAIN_REMAINDERS);
     List<File> files = THYMEData.getFilesFor(trainItems, options.getRawTextDirectory());
 
     CollectionReader reader = UriCollectionReader.getCollectionReaderFromFiles(files);

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintInconsistentAnnotations.java
Thu Sep 25 18:34:15 2014
@@ -68,7 +68,7 @@ public class PrintInconsistentAnnotation
     int windowSize = 50;
     
     List<Integer> patientSets = options.getPatients().getList();
-    List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
+    List<Integer> trainItems = THYMEData.getPatientSets(patientSets, THYMEData.TRAIN_REMAINDERS);
     List<File> files = THYMEData.getFilesFor(trainItems, options.getRawTextDirectory());
 
     CollectionReader reader = UriCollectionReader.getCollectionReaderFromFiles(files);

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/RelationContextViewerPipeline.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/RelationContextViewerPipeline.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/RelationContextViewerPipeline.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/RelationContextViewerPipeline.java
Thu Sep 25 18:34:15 2014
@@ -71,7 +71,7 @@ public class RelationContextViewerPipeli
 		Options options = CliFactory.parseArguments(Options.class, args);
 		
 		List<Integer> patientSets = options.getPatients().getList();
-		List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
+		List<Integer> trainItems = THYMEData.getPatientSets(patientSets, THYMEData.TRAIN_REMAINDERS);
 		List<File> trainFiles = getFilesFor(trainItems, options.getInputDirectory());
     CollectionReader collectionReader = getCollectionReader(trainFiles);
 		

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/TimexTreeAlignmentStatistics.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/TimexTreeAlignmentStatistics.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/TimexTreeAlignmentStatistics.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/TimexTreeAlignmentStatistics.java
Thu Sep 25 18:34:15 2014
@@ -65,7 +65,7 @@ public class TimexTreeAlignmentStatistic
   public static void main(String[] args) throws UIMAException, IOException {
     Options options = CliFactory.parseArguments(Options.class, args);
     List<Integer> patientSets = options.getPatients().getList();
-    List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
+    List<Integer> trainItems = THYMEData.getPatientSets(patientSets, THYMEData.TRAIN_REMAINDERS);
     //List<Integer> devItems = THYMEData.getDevPatientSets(patientSets);
     //List<Integer> testItems = THYMEData.getTestPatientSets(patientSets);
 

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventEventDurationStatistics.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventEventDurationStatistics.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventEventDurationStatistics.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventEventDurationStatistics.java
Thu Sep 25 18:34:15 2014
@@ -69,7 +69,7 @@ public class EventEventDurationStatistic
     Options options = CliFactory.parseArguments(Options.class, args);
 
     List<Integer> patientSets = options.getPatients().getList();
-    List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
+    List<Integer> trainItems = THYMEData.getPatientSets(patientSets, THYMEData.TRAIN_REMAINDERS);
     List<File> trainFiles = Utils.getFilesFor(trainItems, options.getInputDirectory());
     CollectionReader collectionReader = Utils.getCollectionReader(trainFiles);
 

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventTimeDurationStatistics.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventTimeDurationStatistics.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventTimeDurationStatistics.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventTimeDurationStatistics.java
Thu Sep 25 18:34:15 2014
@@ -71,7 +71,7 @@ public class EventTimeDurationStatistics
     Options options = CliFactory.parseArguments(Options.class, args);
 
     List<Integer> patientSets = options.getPatients().getList();
-    List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
+    List<Integer> trainItems = THYMEData.getPatientSets(patientSets, THYMEData.TRAIN_REMAINDERS);
     List<File> trainFiles = Utils.getFilesFor(trainItems, options.getInputDirectory());
     CollectionReader collectionReader = Utils.getCollectionReader(trainFiles);
 

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventProperties.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventProperties.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventProperties.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventProperties.java
Thu Sep 25 18:34:15 2014
@@ -76,18 +76,8 @@ public class EvaluationOfClearTKEventPro
   public static void main(String[] args) throws Exception {
     Options options = CliFactory.parseArguments(Options.class, args);
     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);
-    }
+    List<Integer> trainItems = getTrainItems(options);
+    List<Integer> testItems = getTestItems(options);
     
     EvaluationOfClearTKEventProperties evaluation = new EvaluationOfClearTKEventProperties(
         new File("target/eval/event-properties"),
@@ -97,7 +87,7 @@ public class EvaluationOfClearTKEventPro
         options.getXMIDirectory());
     evaluation.prepareXMIsFor(patientSets);
     evaluation.logClassificationErrors(new File("target/eval"), "ctakes-event-property-errors");
-    Map<String, AnnotationStatistics<String>> stats = evaluation.trainAndTest(allTraining,
allTest);
+    Map<String, AnnotationStatistics<String>> stats = evaluation.trainAndTest(trainItems,
testItems);
     for (String name : PROPERTY_NAMES) {
       System.err.println("====================");
       System.err.println(name);

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventSpans.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventSpans.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventSpans.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKEventSpans.java
Thu Sep 25 18:34:15 2014
@@ -50,18 +50,9 @@ public class EvaluationOfClearTKEventSpa
   public static void main(String[] args) throws Exception {
     Options options = CliFactory.parseArguments(Options.class, args);
     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> trainItems = getTrainItems(options);
+    List<Integer> testItems = getTestItems(options);
     
-    List<Integer> allTraining = new ArrayList<Integer>(trainItems);
-    List<Integer> allTest;
-    if (options.getTest()) {
-      allTraining.addAll(devItems);
-      allTest = new ArrayList<Integer>(testItems);
-    } else {
-      allTest = new ArrayList<Integer>(devItems);
-    }
     EvaluationOfClearTKEventSpans evaluation = new EvaluationOfClearTKEventSpans(
         new File("target/eval/cleartk-event-spans"),
         options.getRawTextDirectory(),
@@ -70,7 +61,7 @@ public class EvaluationOfClearTKEventSpa
         options.getXMIDirectory());
     evaluation.prepareXMIsFor(patientSets);
     evaluation.setLogging(Level.FINE, new File("target/eval/cleartk-event-errors.log"));
-    AnnotationStatistics<String> stats = evaluation.trainAndTest(allTraining, allTest);
+    AnnotationStatistics<String> stats = evaluation.trainAndTest(trainItems, testItems);
     System.err.println(stats);
   }
 

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKRelations.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKRelations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKRelations.java
Thu Sep 25 18:34:15 2014
@@ -82,18 +82,8 @@ public class EvaluationOfClearTKRelation
       System.exit(-1);
     }
     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;
-    if (options.getTest()) {
-      allTraining.addAll(devItems);
-      allTest = new ArrayList<Integer>(testItems);
-    } else {
-      allTest = new ArrayList<Integer>(devItems);
-    }
+    List<Integer> trainItems = getTrainItems(options);
+    List<Integer> testItems = getTestItems(options);
     
     EvaluationOfClearTKRelations evaluation = new EvaluationOfClearTKRelations(
         new File("target/eval/cleartk-event-time-links"),
@@ -105,7 +95,7 @@ public class EvaluationOfClearTKRelation
     evaluation.setExtractEventTime(!options.getIgnoreEventTime());
     
     evaluation.prepareXMIsFor(patientSets);
-    AnnotationStatistics<String> stats = evaluation.trainAndTest(allTraining, allTest);
+    AnnotationStatistics<String> stats = evaluation.trainAndTest(trainItems, testItems);
     System.err.println(stats);
   }
   

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKTimeSpans.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKTimeSpans.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKTimeSpans.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfClearTKTimeSpans.java
Thu Sep 25 18:34:15 2014
@@ -50,18 +50,8 @@ public class EvaluationOfClearTKTimeSpan
   public static void main(String[] args) throws Exception {
     Options options = CliFactory.parseArguments(Options.class, args);
     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;
-    if (options.getTest()) {
-      allTraining.addAll(devItems);
-      allTest = new ArrayList<Integer>(testItems);
-    } else {
-      allTest = new ArrayList<Integer>(devItems);
-    }
+    List<Integer> trainItems = getTrainItems(options);
+    List<Integer> testItems = getTestItems(options);
     
     EvaluationOfClearTKTimeSpans evaluation = new EvaluationOfClearTKTimeSpans(
         new File("target/eval/cleartk-time-spans"),
@@ -71,7 +61,7 @@ public class EvaluationOfClearTKTimeSpan
         options.getXMIDirectory());
     evaluation.prepareXMIsFor(patientSets);
     evaluation.setLogging(Level.FINE, new File("target/eval/cleartk-time-errors.log"));
-    AnnotationStatistics<String> stats = evaluation.trainAndTest(allTraining, allTest);
+    AnnotationStatistics<String> stats = evaluation.trainAndTest(trainItems, testItems);
     System.err.println(stats);
   }
 

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventCoreference.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventCoreference.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventCoreference.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventCoreference.java
Thu Sep 25 18:34:15 2014
@@ -85,14 +85,11 @@ public class EvaluationOfEventCoreferenc
 
   public static void main(String[] args) throws Exception {
     CoreferenceOptions options = CliFactory.parseArguments(CoreferenceOptions.class, args);
-    List<Integer> trainItems = null;
-    List<Integer> devItems = null;
-    List<Integer> testItems = null;
-    
+
     List<Integer> patientSets = options.getPatients().getList();
-    trainItems = THYMEData.getTrainPatientSets(patientSets);
-    devItems = THYMEData.getDevPatientSets(patientSets);
-    testItems = THYMEData.getTestPatientSets(patientSets);
+    List<Integer> trainItems = getTrainItems(options);
+    List<Integer> testItems = getTestItems(options);
+
     ParameterSettings params = allParams;
     File workingDir = new File("target/eval/temporal-relations/coreference");
     if(!workingDir.exists()) workingDir.mkdirs();
@@ -117,15 +114,8 @@ public class EvaluationOfEventCoreferenc
         options.getOutputDirectory());
 
     eval.prepareXMIsFor(patientSets);
-    List<Integer> training = trainItems;
-    List<Integer> testing = null;
-    if(options.getTest()){
-      training.addAll(devItems);
-      testing = testItems;
-    }else{
-      testing = devItems;
-    }
-    params.stats = eval.trainAndTest(training, testing);//training);//
+
+    params.stats = eval.trainAndTest(trainItems, testItems);//training);//
     //      System.err.println(options.getKernelParams() == null ? params : options.getKernelParams());
     System.err.println(params.stats);
 

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventRelations.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventRelations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventRelations.java
Thu Sep 25 18:34:15 2014
@@ -196,9 +196,9 @@ EvaluationOfTemporalRelations_ImplBase {
   public static void main(String[] args) throws Exception{
     TempRelOptions options = CliFactory.parseArguments(TempRelOptions.class, args);
     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> trainItems = getTrainItems(options);
+    List<Integer> testItems = getTestItems(options);
+
     File workingDir = new File("target/eval/temporal-relations/event-event/");
     ParameterSettings params = defaultParams;
     EvaluationOfEventEventRelations evaluation = new EvaluationOfEventEventRelations(
@@ -213,15 +213,8 @@ EvaluationOfTemporalRelations_ImplBase {
         options.getBaseline(),
         params);
     evaluation.prepareXMIsFor(patientSets);
-    List<Integer> training = trainItems;
-    List<Integer> testing = null;
-    if(options.getTest()){
-      training.addAll(devItems);
-      testing = testItems;
-    }else{
-      testing = devItems;
-    }
-    AnnotationStatistics<String> stats = evaluation.trainAndTest(training, testing);
+
+    AnnotationStatistics<String> stats = evaluation.trainAndTest(trainItems, testItems);
     System.err.println(stats);
   }
 

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=1627585&r1=1627584&r2=1627585&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
Thu Sep 25 18:34:15 2014
@@ -88,9 +88,8 @@ Evaluation_ImplBase<Map<String, Annotati
 	public static void main(String[] args) throws Exception {
 		TempRelOptions options = CliFactory.parseArguments(TempRelOptions.class, args);
 		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> trainItems = getTrainItems(options);
+		List<Integer> testItems = getTestItems(options);
 
 		try{
 			File workingDir = new File("target/eval/event-properties");
@@ -111,17 +110,7 @@ Evaluation_ImplBase<Map<String, Annotati
 			evaluation.prepareXMIsFor(patientSets);
 			evaluation.logClassificationErrors(workingDir, "ctakes-event-property-errors");
 
-			List<Integer> allTraining = new ArrayList<>(trainItems);
-			List<Integer> allTest = null;
-			if(options.getTest()){
-				allTraining.addAll(devItems);
-				allTest = new ArrayList<>(testItems);
-			}else{
-				allTest = new ArrayList<>(devItems);
-			}
-
-
-			Map<String, AnnotationStatistics<String>> stats = evaluation.trainAndTest(allTraining,
allTest);
+			Map<String, AnnotationStatistics<String>> stats = evaluation.trainAndTest(trainItems,
testItems);
 			for (String name : PROPERTY_NAMES) {
 				System.err.println("====================");
 				System.err.println(name);

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
Thu Sep 25 18:34:15 2014
@@ -68,9 +68,9 @@ public class EvaluationOfEventSpans exte
       devItems = I2B2Data.getDevPatientSets(options.getXMLDirectory());
       testItems = I2B2Data.getTestPatientSets(options.getXMLDirectory());
     }else{
-      trainItems = THYMEData.getTrainPatientSets(patientSets);
-      devItems = THYMEData.getDevPatientSets(patientSets);
-      testItems = THYMEData.getTestPatientSets(patientSets);
+      trainItems = THYMEData.getPatientSets(patientSets, options.getTrainRemainders().getList());
+      devItems = THYMEData.getPatientSets(patientSets, options.getDevRemainders().getList());
+      testItems = THYMEData.getPatientSets(patientSets, options.getTestRemainders().getList());
     }
     
     List<Integer> allTraining = new ArrayList<Integer>(trainItems);

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java
Thu Sep 25 18:34:15 2014
@@ -125,9 +125,9 @@ EvaluationOfTemporalRelations_ImplBase{
       devItems = I2B2Data.getDevPatientSets(options.getXMLDirectory());
       testItems = I2B2Data.getTestPatientSets(options.getXMLDirectory());
     }else{
-      trainItems = THYMEData.getTrainPatientSets(patientSets);
-      devItems = THYMEData.getDevPatientSets(patientSets);
-      testItems = THYMEData.getTestPatientSets(patientSets);
+      trainItems = THYMEData.getPatientSets(patientSets, options.getTrainRemainders().getList());
+      devItems = THYMEData.getPatientSets(patientSets, options.getDevRemainders().getList());
+      testItems = THYMEData.getPatientSets(patientSets, options.getTestRemainders().getList());
     }
 		ParameterSettings params = allParams;
 

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfMetaTimeExpressionExtractor.java
Thu Sep 25 18:34:15 2014
@@ -74,9 +74,9 @@ public class EvaluationOfMetaTimeExpress
       devItems = I2B2Data.getDevPatientSets(options.getXMLDirectory());
       testItems = I2B2Data.getTestPatientSets(options.getXMLDirectory());
     }else{
-      trainItems = THYMEData.getTrainPatientSets(patientSets);
-      devItems = THYMEData.getDevPatientSets(patientSets);
-      testItems = THYMEData.getTestPatientSets(patientSets);
+      trainItems = THYMEData.getPatientSets(patientSets, options.getTrainRemainders().getList());
+      devItems = THYMEData.getPatientSets(patientSets, options.getDevRemainders().getList());
+      testItems = THYMEData.getPatientSets(patientSets, options.getTestRemainders().getList());
     }
     List<Integer> allTrain = new ArrayList<>(trainItems);
     List<Integer> allTest = null;

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfNEPredicateEventSpans.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfNEPredicateEventSpans.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfNEPredicateEventSpans.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfNEPredicateEventSpans.java
Thu Sep 25 18:34:15 2014
@@ -93,8 +93,8 @@ public class EvaluationOfNEPredicateEven
 	public static void main(String[] args) throws Exception{
 		Options options = CliFactory.parseArguments(Options.class, args);
 	    List<Integer> patientSets = options.getPatients().getList();
-	    List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
-	    List<Integer> devItems = THYMEData.getDevPatientSets(patientSets);
+	    List<Integer> trainItems = getTrainItems(options);
+	    List<Integer> testItems = getTestItems(options);
 	    EvaluationOfNEPredicateEventSpans evaluation = new EvaluationOfNEPredicateEventSpans(
 	        new File("target/eval/event-spans"),
 	        options.getRawTextDirectory(),
@@ -103,7 +103,7 @@ public class EvaluationOfNEPredicateEven
 	        options.getXMIDirectory());
 	    evaluation.prepareXMIsFor(patientSets);
 	    evaluation.setLogging(Level.FINE, new File("target/eval/ctakes-event-errors.log"));
-	    AnnotationStatistics<String> stats = evaluation.trainAndTest(trainItems, devItems);
+	    AnnotationStatistics<String> stats = evaluation.trainAndTest(trainItems, testItems);
 	    System.err.println(stats);
 
 	}

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTemporalRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTemporalRelations.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTemporalRelations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTemporalRelations.java
Thu Sep 25 18:34:15 2014
@@ -133,9 +133,9 @@ EvaluationOfTemporalRelations_ImplBase{
 			devItems = I2B2Data.getDevPatientSets(options.getXMLDirectory());
 			testItems = I2B2Data.getTestPatientSets(options.getXMLDirectory());
 		}else{
-			trainItems = THYMEData.getTrainPatientSets(patientSets);
-			devItems = THYMEData.getDevPatientSets(patientSets);
-			testItems = THYMEData.getTestPatientSets(patientSets);
+			trainItems = THYMEData.getPatientSets(patientSets, options.getTrainRemainders().getList());
+			devItems = THYMEData.getPatientSets(patientSets, options.getDevRemainders().getList());
+			testItems = THYMEData.getPatientSets(patientSets, options.getTestRemainders().getList());
 		}
 		ParameterSettings params = allParams;
 

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java
Thu Sep 25 18:34:15 2014
@@ -99,9 +99,9 @@ public class EvaluationOfTimeSpans exten
       devItems = I2B2Data.getDevPatientSets(options.getXMLDirectory());
       testItems = I2B2Data.getTestPatientSets(options.getXMLDirectory());
     }else{
-      trainItems = THYMEData.getTrainPatientSets(patientSets);
-      devItems = THYMEData.getDevPatientSets(patientSets);
-      testItems = THYMEData.getTestPatientSets(patientSets);
+      trainItems = THYMEData.getPatientSets(patientSets, options.getTrainRemainders().getList());
+      devItems = THYMEData.getPatientSets(patientSets, options.getDevRemainders().getList());
+      testItems = THYMEData.getPatientSets(patientSets, options.getTestRemainders().getList());
     }
 		
 		List<Integer> allTrain = new ArrayList<Integer>(trainItems);

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
Thu Sep 25 18:34:15 2014
@@ -145,6 +145,15 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 		@Option(longName = "patients")
 		public CommandLine.IntegerRanges getPatients();
 
+		@Option(longName = "train-remainders", defaultValue = "0-3")
+		public CommandLine.IntegerRanges getTrainRemainders();
+
+		@Option(longName = "dev-remainders", defaultValue = "4-5")
+		public CommandLine.IntegerRanges getDevRemainders();
+
+		@Option(longName = "test-remainders", defaultValue = "6-7")
+		public CommandLine.IntegerRanges getTestRemainders();
+
 		@Option(longName = "treebank", defaultToNull=true)
 		public File getTreebankDirectory();
 
@@ -173,7 +182,27 @@ org.cleartk.eval.Evaluation_ImplBase<Int
 		public String getI2B2Output();
 	}
 
-	protected File rawTextDirectory;
+    public static List<Integer> getTrainItems(Options options) {
+        List<Integer> patientSets = options.getPatients().getList();
+        List<Integer> trainItems = THYMEData.getPatientSets(patientSets, options.getTrainRemainders().getList());
+        if (options.getTest()) {
+            trainItems.addAll(THYMEData.getPatientSets(patientSets, options.getDevRemainders().getList()));
+        }
+        return trainItems;
+    }
+
+    public static List<Integer> getTestItems(Options options) {
+        List<Integer> patientSets = options.getPatients().getList();
+        List<Integer> testItems;
+        if (options.getTest()) {
+            testItems = THYMEData.getPatientSets(patientSets, options.getTestRemainders().getList());
+        } else {
+            testItems = THYMEData.getPatientSets(patientSets, options.getDevRemainders().getList());
+        }
+        return testItems;
+    }
+
+    protected File rawTextDirectory;
 
 	protected File xmlDirectory;
 

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/THYMEData.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/THYMEData.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/THYMEData.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/THYMEData.java
Thu Sep 25 18:34:15 2014
@@ -20,10 +20,7 @@ package org.apache.ctakes.temporal.eval;
 
 import java.io.File;
 import java.io.FilenameFilter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 import com.google.common.collect.Sets;
 
@@ -33,40 +30,43 @@ import com.google.common.collect.Sets;
 public class THYMEData {
   public static final Set<String> SEGMENTS_TO_SKIP = Sets.newHashSet("20104", "20105",
"20116", "20138");
 
-  public static List<Integer> getTrainPatientSets(List<Integer> patientSets)
{
+  public static final Set<Integer> TRAIN_REMAINDERS = Sets.newHashSet(0, 1, 2, 3);
+  public static final Set<Integer> DEV_REMAINDERS = Sets.newHashSet(4, 5);
+  public static final Set<Integer> TEST_REMAINDERS = Sets.newHashSet(6, 7);
+
+  public static List<Integer> getPatientSets(List<Integer> patientSets, Collection<Integer>
remainders) {
     List<Integer> items = new ArrayList<Integer>();
     for (Integer i : patientSets) {
       int remainder = i % 8;
-      if (remainder < 4) {
+      if (remainders.contains(remainder)) {
         items.add(i);
       }
     }
     return items;
   }
 
+  /**
+   * @deprecated Use getPatientSets(patientSets, TRAIN_REMAINDERS)
+   */
+  public static List<Integer> getTrainPatientSets(List<Integer> patientSets)
{
+    return getPatientSets(patientSets, TRAIN_REMAINDERS);
+  }
+
+  /**
+   * @deprecated Use getPatientSets(patientSets, DEV_REMAINDERS)
+   */
   public static List<Integer> getDevPatientSets(List<Integer> patientSets) {
-    List<Integer> items = new ArrayList<Integer>();
-    for (Integer i : patientSets) {
-      int remainder = i % 8;
-      if (4 <= remainder && remainder < 6) {
-        items.add(i);
-      }
-    }
-    return items;
+    return getPatientSets(patientSets, DEV_REMAINDERS);
   }
 
+  /**
+   * @deprecated Use getPatientSets(patientSets, TEST_REMAINDERS)
+   */
   public static List<Integer> getTestPatientSets(List<Integer> patientSets) {
-    List<Integer> items = new ArrayList<Integer>();
-    for (Integer i : patientSets) {
-      int remainder = i % 8;
-      if (6 <= remainder) {
-        items.add(i);
-      }
-    }
-    return items;
+    return getPatientSets(patientSets, TEST_REMAINDERS);
   }
-  
-  public static List<File> getFilesFor(List<Integer> patientSets, File rawTextDirectory)
{
+
+    public static List<File> getFilesFor(List<Integer> patientSets, File rawTextDirectory)
{
 	  if ( !rawTextDirectory.exists() ) {
 		  return Collections.emptyList();
 	  }

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/RunCorpusDiagnostics.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/RunCorpusDiagnostics.java?rev=1627585&r1=1627584&r2=1627585&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/RunCorpusDiagnostics.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/utils/RunCorpusDiagnostics.java
Thu Sep 25 18:34:15 2014
@@ -71,7 +71,7 @@ public class RunCorpusDiagnostics {
 	public static void main(String[] args) throws UIMAException, IOException {
 		Options options = CliFactory.parseArguments(Options.class, args);
 		List<Integer> patientSets = options.getPatients().getList();
-		List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
+		List<Integer> trainItems = THYMEData.getPatientSets(patientSets, THYMEData.TRAIN_REMAINDERS);
 		CollectionReader reader = UriCollectionReader.getCollectionReaderFromFiles(getFilesFor(options.getRawTextDirectory(),
trainItems));
 		AggregateBuilder aggregateBuilder = new AggregateBuilder();
 		aggregateBuilder.add(UriToDocumentTextAnnotator.getDescription());



Mime
View raw message