ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1510715 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfTimeSpans.java
Date Mon, 05 Aug 2013 20:35:23 GMT
Author: tmill
Date: Mon Aug  5 20:35:22 2013
New Revision: 1510715

URL: http://svn.apache.org/r1510715
Log:
Updated default parameters based on 1-27 dev set, and made to use test flag for evaluations.

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

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=1510715&r1=1510714&r2=1510715&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
Mon Aug  5 20:35:22 2013
@@ -19,6 +19,7 @@
 package org.apache.ctakes.temporal.eval;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -39,7 +40,6 @@ import org.apache.uima.resource.Resource
 import org.cleartk.classifier.CleartkAnnotator;
 import org.cleartk.classifier.CleartkSequenceAnnotator;
 import org.cleartk.classifier.Instance;
-//import org.cleartk.classifier.DataWriter;
 import org.cleartk.classifier.crfsuite.CRFSuiteStringOutcomeDataWriter;
 import org.cleartk.classifier.feature.transform.InstanceDataWriter;
 import org.cleartk.classifier.feature.transform.InstanceStream;
@@ -64,7 +64,7 @@ public class EvaluationOfTimeSpans exten
 
 	static interface Options extends Evaluation_ImplBase.Options {
 
-		@Option(longName = "featureSelectionThreshold", defaultValue = "1")
+	  @Option(longName = "featureSelectionThreshold", defaultValue = "1")
 		public float getFeatureSelectionThreshold();
 		
 		@Option(longName = "SMOTENeighborNumber", defaultValue = "0")
@@ -76,7 +76,18 @@ public class EvaluationOfTimeSpans exten
 		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> allTrain = new ArrayList<Integer>(trainItems);
+		List<Integer> allTest = null;
+		
+		if(options.getTest()){
+		  allTrain.addAll(devItems);
+		  allTest = new ArrayList<Integer>(testItems);
+		}else{
+		  allTest = new ArrayList<Integer>(devItems);
+		}
+		
 		// specify the annotator classes to use
 		List<Class<? extends JCasAnnotator_ImplBase>> annotatorClasses = Lists.newArrayList();
 		annotatorClasses.add(BackwardsTimeAnnotator.class);
@@ -85,11 +96,11 @@ public class EvaluationOfTimeSpans exten
 		annotatorClasses.add(CRFTimeAnnotator.class);
 		annotatorClasses.add(MetaTimeAnnotator.class);
 		Map<Class<? extends JCasAnnotator_ImplBase>, String[]> annotatorTrainingArguments
= Maps.newHashMap();
-		annotatorTrainingArguments.put(BackwardsTimeAnnotator.class, new String[]{"-c", "0.1"});
+		annotatorTrainingArguments.put(BackwardsTimeAnnotator.class, new String[]{"-c", "0.3"});
 		annotatorTrainingArguments.put(TimeAnnotator.class, new String[]{"-c", "0.1"});
-		annotatorTrainingArguments.put(ConstituencyBasedTimeAnnotator.class, new String[]{"-c",
"0.1"});
-		annotatorTrainingArguments.put(CRFTimeAnnotator.class, new String[]{"-p", "c2=0.1"});
-		annotatorTrainingArguments.put(MetaTimeAnnotator.class, new String[]{"-p", "c2=0.1"});
+		annotatorTrainingArguments.put(ConstituencyBasedTimeAnnotator.class, new String[]{"-c",
"0.3"});
+		annotatorTrainingArguments.put(CRFTimeAnnotator.class, new String[]{"-p", "c2=0.03"});
+		annotatorTrainingArguments.put(MetaTimeAnnotator.class, new String[]{"-p", "c2=0.3"});
 
 		// run one evaluation per annotator class
 		final Map<Class<?>, AnnotationStatistics<?>> annotatorStats = Maps.newHashMap();
@@ -109,7 +120,7 @@ public class EvaluationOfTimeSpans exten
 			evaluation.prepareXMIsFor(patientSets);
 			String name = String.format("%s.errors", annotatorClass.getSimpleName());
 			evaluation.setLogging(Level.FINE, new File("target/eval", name));
-			AnnotationStatistics<String> stats = evaluation.trainAndTest(trainItems, devItems);
+			AnnotationStatistics<String> stats = evaluation.trainAndTest(allTrain, allTest);
 			annotatorStats.put(annotatorClass, stats);
 		}
 



Mime
View raw message