ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1764520 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java
Date Wed, 12 Oct 2016 19:33:28 GMT
Author: dligach
Date: Wed Oct 12 19:33:27 2016
New Revision: 1764520

URL: http://svn.apache.org/viewvc?rev=1764520&view=rev
Log:
added downsampling

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java?rev=1764520&r1=1764519&r2=1764520&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java
Wed Oct 12 19:33:27 2016
@@ -5,6 +5,7 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Random;
 
 import org.apache.ctakes.temporal.ae.TemporalRelationExtractorAnnotator.IdentifiedAnnotationPair;
 import org.apache.ctakes.temporal.nn.data.EventEventRelPrinter;
@@ -28,6 +29,7 @@ import com.google.common.collect.Lists;
 public class EventEventTokenBasedAnnotator extends CleartkAnnotator<String> {
 
   public static final String NO_RELATION_CATEGORY = "none";
+  private Random coin = new Random(0);
 
   @Override
   public void process(JCas jCas) throws AnalysisEngineProcessException {
@@ -83,6 +85,12 @@ public class EventEventTokenBasedAnnotat
         // during training, feed the features to the data writer
         if(this.isTraining()) {
           String category = getRelationCategory(relationLookup, arg1, arg2);
+          
+          // drop some portion of negative examples during training
+          if(category == null && coin.nextDouble() <= 0.5) {
+            continue; // skip this negative example
+          }
+          
           if(category == null) {
             category = NO_RELATION_CATEGORY;
           } else{



Mime
View raw message