You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by td...@apache.org on 2010/09/08 20:02:23 UTC

svn commit: r995173 - in /mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd: AdaptiveLogisticRegressionTest.java OnlineLogisticRegressionTest.java

Author: tdunning
Date: Wed Sep  8 18:02:22 2010
New Revision: 995173

URL: http://svn.apache.org/viewvc?rev=995173&view=rev
Log:
Add teeth to test cases.

Modified:
    mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegressionTest.java
    mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/OnlineLogisticRegressionTest.java

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegressionTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegressionTest.java?rev=995173&r1=995172&r2=995173&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegressionTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/AdaptiveLogisticRegressionTest.java Wed Sep  8 18:02:22 2010
@@ -30,7 +30,6 @@ public final class AdaptiveLogisticRegre
 
   @Test
   public void testTrain() {
-    // we make up data for a simple model
 
     Random gen = RandomUtils.getRandom();
     Exponential exp = new Exponential(0.5, gen);
@@ -54,6 +53,7 @@ public final class AdaptiveLogisticRegre
         System.out.printf("%10d %10.3f\n", i, cl.getLearner().auc());
       }
     }
+    assertEquals(1, cl.getLearner().auc(), 0.1);
 
     AdaptiveLogisticRegression x = new AdaptiveLogisticRegression(2, 200, new L1());
     x.setInterval(1000);
@@ -69,6 +69,7 @@ public final class AdaptiveLogisticRegre
         }
       }
     }
+    assertEquals(1, x.auc(), 0.1);
   }
 
   private static AdaptiveLogisticRegression.TrainingExample getExample(int i, Random gen, Vector beta) {

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/OnlineLogisticRegressionTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/OnlineLogisticRegressionTest.java?rev=995173&r1=995172&r2=995173&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/OnlineLogisticRegressionTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/OnlineLogisticRegressionTest.java Wed Sep  8 18:02:22 2010
@@ -82,7 +82,9 @@ public final class OnlineLogisticRegress
         lr.train(row, (int) data.get(row, 9), data.viewRow(row));
         System.out.printf("%d,%d,%.3f\n", epoch, k++, lr.auc());
       }
+      assertEquals(1, lr.auc(), 0.2);
     }
+    assertEquals(1, lr.auc(), 0.1);
   }
 
   /**