mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdunn...@apache.org
Subject svn commit: r999752 - in /mahout/trunk: core/src/main/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegression.java examples/src/main/java/org/apache/mahout/classifier/sgd/TrainNewsGroups.java
Date Wed, 22 Sep 2010 04:32:26 GMT
Author: tdunning
Date: Wed Sep 22 04:32:26 2010
New Revision: 999752

URL: http://svn.apache.org/viewvc?rev=999752&view=rev
Log:
output format change to increase sig figs on lambda and mu

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegression.java
    mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/TrainNewsGroups.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegression.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegression.java?rev=999752&r1=999751&r2=999752&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegression.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegression.java
Wed Sep 22 04:32:26 2010
@@ -72,6 +72,8 @@ public class AdaptiveLogisticRegression 
   private int numFeatures;
   private double averagingWindow;
 
+  private boolean freezeSurvivors = true;
+
   // for GSON
   private AdaptiveLogisticRegression() {
   }
@@ -128,11 +130,13 @@ public class AdaptiveLogisticRegression 
     // evolve based on new fitness
     ep.mutatePopulation(SURVIVORS);
 
-    // now grossly hack the top survivors so they stick around.  Set their
-    // mutation rates small and also hack their learning rate to be small
-    // as well.
-    for (State<Wrapper> state : ep.getPopulation().subList(0, SURVIVORS)) {
-      state.getPayload().freeze(state);
+    if (freezeSurvivors) {
+      // now grossly hack the top survivors so they stick around.  Set their
+      // mutation rates small and also hack their learning rate to be small
+      // as well.
+      for (State<Wrapper> state : ep.getPopulation().subList(0, SURVIVORS)) {
+        state.getPayload().freeze(state);
+      }
     }
     buffer.clear();
   }
@@ -269,6 +273,10 @@ public class AdaptiveLogisticRegression 
     seed.getPayload().getLearner().setWindowSize(averagingWindow);
   }
 
+  public void setFreezeSurvivors(boolean freezeSurvivors) {
+    this.freezeSurvivors = freezeSurvivors;
+  }
+
   /**
    * Provides a shim between the EP optimization stuff and the CrossFoldLearner.  The most
important
    * interface has to do with the parameters of the optimization.  These are taken from the
double[]

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/TrainNewsGroups.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/TrainNewsGroups.java?rev=999752&r1=999751&r2=999752&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/TrainNewsGroups.java
(original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/TrainNewsGroups.java
Wed Sep 22 04:32:26 2010
@@ -196,7 +196,7 @@ public class TrainNewsGroups {
       }
       if (k % (bump * scale) == 0) {
         step += 0.25;
-        System.out.printf("%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t", maxBeta, nonZeros, positive,
norm, lambda, mu);
+        System.out.printf("%.2f\t%.2f\t%.2f\t%.2f\t%.8f\t%.8f\t", maxBeta, nonZeros, positive,
norm, lambda, mu);
         System.out.printf("%d\t%.3f\t%.2f\t%s\t%s\n",
           k, averageLL, averageCorrect * 100, ng, leakLabels[leakType % 3]);
       }



Mime
View raw message