Revision: 18978
          http://sourceforge.net/p/gate/code/18978
Author:   adamfunk
Date:     2015-10-29 15:55:39 +0000 (Thu, 29 Oct 2015)
Log Message:
-----------
provide old scale as non-default option

Modified Paths:
--------------
    gate/trunk/plugins/TermRaider/src/gate/termraider/modes/Normalization.java

Modified: 
gate/trunk/plugins/TermRaider/src/gate/termraider/modes/Normalization.java
===================================================================
--- gate/trunk/plugins/TermRaider/src/gate/termraider/modes/Normalization.java  
2015-10-29 15:38:43 UTC (rev 18977)
+++ gate/trunk/plugins/TermRaider/src/gate/termraider/modes/Normalization.java  
2015-10-29 15:55:39 UTC (rev 18978)
@@ -14,14 +14,18 @@
 public enum Normalization {
   None,
   Hundred,
-  Sigmoid;
+  Sigmoid,
+  SigmoidOld;
   
   
   // Old scale was mushing too many terms together where rounding made them
   // all appear tied for 100.0.
-  private static double xScale = 80;
+  // The old scale is available as a non-default option for backward 
compatibility
+  private static double xScaleDefault = 80;
+  private static double xScaleOld = 4.8;
 
   
+  
   public static double calculate(Normalization mode, Number raw) {
     if (mode == None) {
       return raw.doubleValue();
@@ -31,8 +35,13 @@
       return 100.0 * raw.doubleValue();
     }
     
+    if (mode == SigmoidOld) {
+      return normalizeScore(raw.doubleValue(), xScaleOld);
+    }
+    
+    
     // must be sigmoid
-    return normalizeScore(raw.doubleValue());
+    return normalizeScore(raw.doubleValue(), xScaleDefault);
   }
   
   
@@ -43,7 +52,7 @@
    * @param score from 0 to inf 
    * @return score from 0 to 100
    */
-  private static double normalizeScore(double score) {
+  private static double normalizeScore(double score, double xScale) {
     double norm = 2.0 / (1.0 + Math.exp(-score / xScale)) - 1.0;
     return (double) (100.0F * norm);
   }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to