mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r748186 - in /lucene/mahout/trunk/core/src: main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/ test/java/org/apache/mahout/cf/taste/impl/eval/ test/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/
Date Thu, 26 Feb 2009 15:48:00 GMT
Author: srowen
Date: Thu Feb 26 15:47:58 2009
New Revision: 748186

URL: http://svn.apache.org/viewvc?rev=748186&view=rev
Log:
Update heuristic used to prune inconsequential diffs in MemoryDiffStorage to be based on count,
as in the MySQL-based version

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/MemoryDiffStorage.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/eval/AverageAbsoluteDifferenceRecommenderEvaluatorTest.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/eval/RMSRecommenderEvaluatorTest.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=748186&r1=748185&r2=748186&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
Thu Feb 26 15:47:58 2009
@@ -222,15 +222,13 @@
         averageCount = processOneUser(averageCount, user);
       }
 
-      // Go back and prune inconsequential diffs. "Inconsequential" means, here, an average
-      // so small (< 1 / numItems^3) that it contributes very little to computations
-      double numItems = (double) dataModel.getNumItems();
-      double threshold = 1.0 / numItems / numItems / numItems;
+      // Go back and prune inconsequential diffs. "Inconsequential" means, here, only represented
by one
+      // data point, so possibly unreliable
       for (Iterator<FastMap<Object, RunningAverage>> it1 = averageDiffs.values().iterator();
it1.hasNext();) {
         FastMap<Object, RunningAverage> map = it1.next();
         for (Iterator<RunningAverage> it2 = map.values().iterator(); it2.hasNext();)
{
           RunningAverage average = it2.next();
-          if (Math.abs(average.getAverage()) < threshold) {
+          if (average.getCount() <= 1) {
             it2.remove();
           }
         }

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/eval/AverageAbsoluteDifferenceRecommenderEvaluatorTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/eval/AverageAbsoluteDifferenceRecommenderEvaluatorTest.java?rev=748186&r1=748185&r2=748186&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/eval/AverageAbsoluteDifferenceRecommenderEvaluatorTest.java
(original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/eval/AverageAbsoluteDifferenceRecommenderEvaluatorTest.java
Thu Feb 26 15:47:58 2009
@@ -36,8 +36,8 @@
     };
     RecommenderEvaluator evaluator =
             new AverageAbsoluteDifferenceRecommenderEvaluator();
-    double eval = evaluator.evaluate(builder, model, 0.75, 1.0);
-    assertEquals(0.31111111111111106, eval, EPSILON);
+    double eval = evaluator.evaluate(builder, model, 0.85, 1.0);
+    assertEquals(0.2234257618121795, eval, EPSILON);
   }
 
 }

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/eval/RMSRecommenderEvaluatorTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/eval/RMSRecommenderEvaluatorTest.java?rev=748186&r1=748185&r2=748186&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/eval/RMSRecommenderEvaluatorTest.java
(original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/eval/RMSRecommenderEvaluatorTest.java
Thu Feb 26 15:47:58 2009
@@ -35,8 +35,8 @@
       }
     };
     RecommenderEvaluator evaluator = new RMSRecommenderEvaluator();
-    double eval = evaluator.evaluate(builder, model, 0.75, 1.0);
-    assertEquals(0.387776185924781, eval, EPSILON);
+    double eval = evaluator.evaluate(builder, model, 0.85, 1.0);
+    assertEquals(0.3004147161079469, eval, EPSILON);
   }
 
 }
\ No newline at end of file

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=748186&r1=748185&r2=748186&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
Thu Feb 26 15:47:58 2009
@@ -114,7 +114,7 @@
     users.add(getUser("test2", 0.2, 0.3, 0.6));
     DataModel dataModel = new GenericDataModel(users);
     Recommender recommender = new SlopeOneRecommender(dataModel);
-    assertEquals(0.5, recommender.estimatePreference("test1", "2"), EPSILON);
+    assertEquals(0.6, recommender.estimatePreference("test1", "2"), EPSILON);
   }
 
   private static Recommender buildRecommender() throws TasteException {



Mime
View raw message