ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1510692 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventTimeRelations.java
Date Mon, 05 Aug 2013 19:59:34 GMT
Author: tmill
Date: Mon Aug  5 19:59:34 2013
New Revision: 1510692

URL: http://svn.apache.org/r1510692
Log:
Fixed so that by default it uses normal model directory, and only uses a tmp file if specified
(for parallelized grid searches)

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

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=1510692&r1=1510691&r2=1510692&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
Mon Aug  5 19:59:34 2013
@@ -47,10 +47,12 @@ import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.tcas.Annotation;
 import org.apache.uima.resource.ResourceInitializationException;
 import org.cleartk.classifier.jar.JarClassifierBuilder;
+import org.cleartk.classifier.svmlight.SVMlightStringOutcomeDataWriter;
 import org.cleartk.classifier.tksvmlight.TKSVMlightStringOutcomeDataWriter;
 import org.cleartk.classifier.tksvmlight.model.CompositeKernel;
 import org.cleartk.classifier.tksvmlight.model.CompositeKernel.ComboOperator;
 import org.cleartk.eval.AnnotationStatistics;
+import org.cleartk.ml.libsvm.tk.TKLIBSVMStringOutcomeDataWriter;
 import org.cleartk.util.ViewURIUtil;
 import org.uimafit.component.JCasAnnotator_ImplBase;
 import org.uimafit.descriptor.ConfigurationParameter;
@@ -84,6 +86,9 @@ public class EvaluationOfEventTimeRelati
     
     @Option
     public boolean getClosure();
+    
+    @Option
+    public boolean getUseTmp();
   }
   
 //  protected static boolean DEFAULT_BOTH_DIRECTIONS = false;
@@ -122,11 +127,14 @@ public class EvaluationOfEventTimeRelati
     try{
       File workingDir = new File("target/eval/temporal-relations/event-time");
       if(!workingDir.exists()) workingDir.mkdirs();
-      File tempModelDir = File.createTempFile("temporal", null, workingDir);
-      tempModelDir.delete();
-      tempModelDir.mkdir();
+      if(options.getUseTmp()){
+        File tempModelDir = File.createTempFile("temporal", null, workingDir);
+        tempModelDir.delete();
+        tempModelDir.mkdir();
+        workingDir = tempModelDir;
+      }
       EvaluationOfEventTimeRelations evaluation = new EvaluationOfEventTimeRelations(
-          tempModelDir,
+          workingDir,
           options.getRawTextDirectory(),
           options.getXMLDirectory(),
           options.getXMLFormat(),
@@ -150,7 +158,9 @@ public class EvaluationOfEventTimeRelati
       params.stats = evaluation.trainAndTest(training, testing);
       //      System.err.println(options.getKernelParams() == null ? params : options.getKernelParams());
       System.err.println(params.stats);
-      tempModelDir.delete();
+      if(options.getUseTmp()){
+        workingDir.delete();
+      }
     }catch(ResourceInitializationException e){
       System.err.println("Error with parameter settings: " + params);
       e.printStackTrace();
@@ -216,6 +226,8 @@ public class EvaluationOfEventTimeRelati
     aggregateBuilder.add(EventTimeRelationAnnotator.createDataWriterDescription(
 //                LIBSVMStringOutcomeDataWriter.class,
         TKSVMlightStringOutcomeDataWriter.class,
+//        TKLIBSVMStringOutcomeDataWriter.class,
+//        SVMlightStringOutcomeDataWriter.class,        
         directory,
         params.probabilityOfKeepingANegativeExample));
     SimplePipeline.runPipeline(collectionReader, aggregateBuilder.createAggregate());



Mime
View raw message