ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1733633 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal: ae/feature/EventArgumentPropertyExtractor.java eval/EvaluationOfEventEventThymeRelations.java eval/Evaluation_ImplBase.java
Date Fri, 04 Mar 2016 18:47:01 GMT
Author: clin
Date: Fri Mar  4 18:47:00 2016
New Revision: 1733633

URL: http://svn.apache.org/viewvc?rev=1733633&view=rev
Log:
-Fixed a bug that can cause discrepancy between runs on different system: EventArgumentPropertyExtractor::mention.getEvent().getProperties().getTypeIndexID()
will get different values on different systems.
-Make runtime parameter: --testOnTrain for event-event evaluation.
-Sort both patients and documents before processing

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventThymeRelations.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java?rev=1733633&r1=1733632&r2=1733633&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
Fri Mar  4 18:47:00 2016
@@ -103,7 +103,7 @@ RelationFeaturesExtractor<IdentifiedAnno
 
 		Integer typeId = mention.getEvent().getProperties().getTypeIndexID();
 		if(typeId != null)
-			feats.add(new Feature(name + "_typeId", typeId));
+			feats.add(new Feature(name + "_typeId"));
 
 		return feats;
 	}

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventThymeRelations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventThymeRelations.java?rev=1733633&r1=1733632&r2=1733633&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventThymeRelations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventEventThymeRelations.java
Fri Mar  4 18:47:00 2016
@@ -109,6 +109,9 @@ EvaluationOfTemporalRelations_ImplBase{
 
 		@Option
 		public boolean getSkipTrain();
+		
+		@Option
+		public boolean getTestOnTrain();
 	}
 
 	//  protected static boolean DEFAULT_BOTH_DIRECTIONS = false;
@@ -206,7 +209,18 @@ EvaluationOfTemporalRelations_ImplBase{
 				evaluation.prepareXMIsFor(patientSets);
 			}
 			evaluation.printErrors=true;
-			params.stats = evaluation.trainAndTest(training, testing);//training);//
+			
+			//sort list:
+			Collections.sort(training);
+			Collections.sort(testing);
+			
+			//test or train or test
+			evaluation.testOnTrain = options.getTestOnTrain();
+			if(evaluation.testOnTrain){
+				params.stats = evaluation.trainAndTest(training, training);
+			}else{//test on testing set
+				params.stats = evaluation.trainAndTest(training, testing);//training
+			}
 			//      System.err.println(options.getKernelParams() == null ? params : options.getKernelParams());
 			//			System.err.println("No closure on gold::Closure on System::Recall Mode");
 			System.err.println(params.stats);
@@ -248,6 +262,7 @@ EvaluationOfTemporalRelations_ImplBase{
 	protected boolean useClosure;
 	protected boolean useGoldAttributes;
 	protected boolean skipTrain=false;
+	protected boolean testOnTrain=false;
 	//  protected boolean printRelations = false;
 
 	public EvaluationOfEventEventThymeRelations(
@@ -314,7 +329,7 @@ EvaluationOfTemporalRelations_ImplBase{
 		aggregateBuilder.add(AnalysisEngineFactory.createEngineDescription(RemoveNonContainsRelations.class));
 		//		aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(AddFlippedOverlap.class));//add
flipped overlap instances to training data
 
-		aggregateBuilder.add(AnalysisEngineFactory.createEngineDescription(Overlap2Contains.class));
+//		aggregateBuilder.add(AnalysisEngineFactory.createEngineDescription(Overlap2Contains.class));
 
 
 		//		aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(RemoveNonUMLSEvents.class));
@@ -324,7 +339,7 @@ EvaluationOfTemporalRelations_ImplBase{
 
 		aggregateBuilder.add(EventEventRelationAnnotator.createDataWriterDescription(
 				LibLinearStringOutcomeDataWriter.class,
-				//				LibSvmStringOutcomeDataWriter.class,
+//								LibSvmStringOutcomeDataWriter.class,
 				//				TKSVMlightStringOutcomeDataWriter.class,
 				//        TKLIBSVMStringOutcomeDataWriter.class,
 				//        SVMlightStringOutcomeDataWriter.class,        

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=1733633&r1=1733632&r2=1733633&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
Fri Mar  4 18:47:00 2016
@@ -385,6 +385,10 @@ public abstract class Evaluation_ImplBas
    @Override
    protected CollectionReader getCollectionReader( List<Integer> patientSets ) throws
Exception {
       List<File> collectedFiles = this.getFilesFor( patientSets );
+      Collections.sort(collectedFiles);
+//      for(File file : collectedFiles){
+//    	  System.err.println(file.getName());
+//      }
       /**
        if(isTraining){
        final Collection<File> filesToRemove = new HashSet<>();



Mime
View raw message