ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1733656 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventProperties.java
Date Fri, 04 Mar 2016 21:36:03 GMT
Author: clin
Date: Fri Mar  4 21:36:02 2016
New Revision: 1733656

URL: http://svn.apache.org/viewvc?rev=1733656&view=rev
Log:
add parameter --testOnTrain for event-properties evaluator, 
sort patients before processing

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=1733656&r1=1733655&r2=1733656&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
Fri Mar  4 21:36:02 2016
@@ -21,6 +21,7 @@ package org.apache.ctakes.temporal.eval;
 import java.io.File;
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -80,6 +81,9 @@ Evaluation_ImplBase<Map<String, Annotati
 
 		@Option
 		public boolean getSkipTrain();
+		
+		@Option
+		public boolean getTestOnTrain();
 	}
 	private static final String DOC_TIME_REL = "docTimeRel";
 	private static final String CONTEXTUAL_MODALITY = "contextualModality";
@@ -117,7 +121,20 @@ Evaluation_ImplBase<Map<String, Annotati
 			}
 			evaluation.logClassificationErrors(workingDir, "ctakes-event-property-errors");
 
-			Map<String, AnnotationStatistics<String>> stats = evaluation.trainAndTest(trainItems,
testItems);
+			Map<String, AnnotationStatistics<String>> stats = null;
+			
+			//sort list:
+			Collections.sort(trainItems);
+			Collections.sort(testItems);
+			
+			//test or train or test
+			evaluation.testOnTrain = options.getTestOnTrain();
+			if(evaluation.testOnTrain){
+				stats = evaluation.trainAndTest(trainItems, trainItems);
+			}else{//test on testing set
+				stats = evaluation.trainAndTest(trainItems, testItems);//training
+			}
+			
 			for (String name : PROPERTY_NAMES) {
 				System.err.println("====================");
 				System.err.println(name);
@@ -137,6 +154,7 @@ Evaluation_ImplBase<Map<String, Annotati
 
 	private Map<String, Logger> loggers = Maps.newHashMap();
 	protected boolean skipTrain=false;
+	protected boolean testOnTrain=false;
 
 	public EvaluationOfEventProperties(
 			File baseDirectory,



Mime
View raw message