mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r834083 - in /lucene/mahout/trunk/core/src: main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/ main/java/org/apache/mahout/cf/taste/impl/recommender/svd/ test/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/
Date Mon, 09 Nov 2009 14:41:14 GMT
Author: srowen
Date: Mon Nov  9 14:41:00 2009
New Revision: 834083

URL: http://svn.apache.org/viewvc?rev=834083&view=rev
Log:
Oops missed unit test. Remove problematic SVDRecommender constructor that does no training?

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/MemoryDiffStorage.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/SVDRecommender.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/SlopeOneRecommenderTest.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/MemoryDiffStorage.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/MemoryDiffStorage.java?rev=834083&r1=834082&r2=834083&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/MemoryDiffStorage.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/MemoryDiffStorage.java
Mon Nov  9 14:41:00 2009
@@ -271,7 +271,7 @@
     PreferenceArray userPreferences = dataModel.getPreferencesFromUser(userID);
     int length = userPreferences.length();
     for (int i = 0; i < length - 1; i++) {
-      double prefAValue = userPreferences.getValue(i);
+      float prefAValue = userPreferences.getValue(i);
       long itemIDA = userPreferences.getItemID(i);
       FastByIDMap<RunningAverage> aMap = averageDiffs.get(itemIDA);
       if (aMap == null) {

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/SVDRecommender.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/SVDRecommender.java?rev=834083&r1=834082&r2=834083&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/SVDRecommender.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/SVDRecommender.java
Mon Nov  9 14:41:00 2009
@@ -69,12 +69,6 @@
    * @param initialSteps number of initial training steps
    */
   public SVDRecommender(DataModel dataModel, int numFeatures, int initialSteps) throws TasteException
{
-    this(dataModel, numFeatures);
-    train(initialSteps);
-  }
-
-  /** @param numFeatures the number of features */
-  public SVDRecommender(DataModel dataModel, int numFeatures) throws TasteException {
     super(dataModel);
 
     this.numFeatures = numFeatures;
@@ -114,6 +108,7 @@
     });
     refreshHelper.addDependency(dataModel);
 
+    train(initialSteps);
   }
 
   private void recachePreferences() throws TasteException {

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/SlopeOneRecommenderTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/SlopeOneRecommenderTest.java?rev=834083&r1=834082&r2=834083&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/SlopeOneRecommenderTest.java
(original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/SlopeOneRecommenderTest.java
Mon Nov  9 14:41:00 2009
@@ -112,14 +112,15 @@
 
   public void testDiffStdevBehavior() throws Exception {
     DataModel dataModel = getDataModel(
-            new long[] {1, 2},
+            new long[] {1, 2, 3},
             new Double[][] {
                     {0.1, 0.2},
                     {0.2, 0.3, 0.6},
+                    {0.3, 0.3, 0.3},
             });
 
     Recommender recommender = new SlopeOneRecommender(dataModel);
-    assertEquals(0.6, recommender.estimatePreference(1, 2), EPSILON);
+    assertEquals(0.3257f, recommender.estimatePreference(1, 2), EPSILON);
   }
 
   private static Recommender buildRecommender() throws TasteException {



Mime
View raw message