mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r712399 [2/2] - in /lucene/mahout/trunk/core/src: main/java/org/apache/mahout/cf/taste/impl/common/ main/java/org/apache/mahout/cf/taste/impl/neighborhood/ main/java/org/apache/mahout/cf/taste/impl/recommender/ main/java/org/apache/mahout/c...
Date Sat, 08 Nov 2008 14:39:42 GMT
Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommenderTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommenderTest.java?rev=712399&r1=712398&r2=712399&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommenderTest.java
(original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommenderTest.java
Sat Nov  8 06:39:41 2008
@@ -59,17 +59,17 @@
     users.add(getUser("test4", 0.1, 0.4, 0.5, 0.8, 0.9, 1.0));
     users.add(getUser("test5", 0.2, 0.3, 0.6, 0.7, 0.1, 0.2));
     DataModel dataModel = new GenericDataModel(users);
-    Collection<GenericItemSimilarity.ItemItemCorrelation> correlations =
-            new ArrayList<GenericItemSimilarity.ItemItemCorrelation>(6);
+    Collection<GenericItemSimilarity.ItemItemSimilarity> similarities =
+            new ArrayList<GenericItemSimilarity.ItemItemSimilarity>(6);
     for (int i = 0; i < 6; i++) {
       for (int j = i + 1; j < 6; j++) {
-        correlations.add(
-                new GenericItemSimilarity.ItemItemCorrelation(new GenericItem<String>(String.valueOf(i)),
+        similarities.add(
+                new GenericItemSimilarity.ItemItemSimilarity(new GenericItem<String>(String.valueOf(i)),
                                                                new GenericItem<String>(String.valueOf(j)),
                                                                1.0 / (1.0 + (double) i +
(double) j)));
       }
     }
-    ItemSimilarity similarity = new GenericItemSimilarity(correlations);
+    ItemSimilarity similarity = new GenericItemSimilarity(similarities);
     Recommender recommender = new GenericItemBasedRecommender(dataModel, similarity);
     List<RecommendedItem> fewRecommended = recommender.recommend("test1", 2);
     List<RecommendedItem> moreRecommended = recommender.recommend("test1", 4);
@@ -92,15 +92,15 @@
     Item item2 = new GenericItem<String>("1");
     Item item3 = new GenericItem<String>("2");
     Item item4 = new GenericItem<String>("3");
-    Collection<GenericItemSimilarity.ItemItemCorrelation> correlations =
-            new ArrayList<GenericItemSimilarity.ItemItemCorrelation>(6);
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item2, 1.0));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item3, 0.5));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item4, 0.2));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item2, item3, 0.7));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item2, item4, 0.5));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item3, item4, 0.9));
-    ItemSimilarity similarity = new GenericItemSimilarity(correlations);
+    Collection<GenericItemSimilarity.ItemItemSimilarity> similarities =
+            new ArrayList<GenericItemSimilarity.ItemItemSimilarity>(6);
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item2, 1.0));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item3, 0.5));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item4, 0.2));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item2, item3, 0.7));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item2, item4, 0.5));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item3, item4, 0.9));
+    ItemSimilarity similarity = new GenericItemSimilarity(similarities);
     Recommender recommender = new GenericItemBasedRecommender(dataModel, similarity);
     List<RecommendedItem> originalRecommended = recommender.recommend("test1", 2);
     List<RecommendedItem> rescoredRecommended =
@@ -181,14 +181,14 @@
 
   private static ItemBasedRecommender buildRecommender() {
     DataModel dataModel = new GenericDataModel(getMockUsers());
-    Collection<GenericItemSimilarity.ItemItemCorrelation> correlations =
-            new ArrayList<GenericItemSimilarity.ItemItemCorrelation>(2);
+    Collection<GenericItemSimilarity.ItemItemSimilarity> similarities =
+            new ArrayList<GenericItemSimilarity.ItemItemSimilarity>(2);
     Item item1 = new GenericItem<String>("0");
     Item item2 = new GenericItem<String>("1");
     Item item3 = new GenericItem<String>("2");
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item2, 1.0));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item3, 0.5));
-    ItemSimilarity similarity = new GenericItemSimilarity(correlations);
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item2, 1.0));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item3, 0.5));
+    ItemSimilarity similarity = new GenericItemSimilarity(similarities);
     return new GenericItemBasedRecommender(dataModel, similarity);
   }
 
@@ -199,24 +199,24 @@
     users.add(getUser("test3", 0.4, 0.3, 0.5, 0.1, 0.1));
     users.add(getUser("test4", 0.7, 0.3, 0.8, 0.5, 0.6));
     DataModel dataModel = new GenericDataModel(users);
-    Collection<GenericItemSimilarity.ItemItemCorrelation> correlations =
-            new ArrayList<GenericItemSimilarity.ItemItemCorrelation>(10);
+    Collection<GenericItemSimilarity.ItemItemSimilarity> similarities =
+            new ArrayList<GenericItemSimilarity.ItemItemSimilarity>(10);
     Item item1 = new GenericItem<String>("0");
     Item item2 = new GenericItem<String>("1");
     Item item3 = new GenericItem<String>("2");
     Item item4 = new GenericItem<String>("3");
     Item item5 = new GenericItem<String>("4");
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item2, 1.0));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item3, 0.8));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item4, -0.6));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item5, 1.0));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item2, item3, 0.9));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item2, item4, 0.0));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item2, item2, 1.0));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item3, item4, -0.1));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item3, item5, 0.1));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item4, item5, -0.5));
-    ItemSimilarity similarity = new GenericItemSimilarity(correlations);
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item2, 1.0));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item3, 0.8));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item4, -0.6));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item5, 1.0));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item2, item3, 0.9));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item2, item4, 0.0));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item2, item2, 1.0));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item3, item4, -0.1));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item3, item5, 0.1));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item4, item5, -0.5));
+    ItemSimilarity similarity = new GenericItemSimilarity(similarities);
     return new GenericItemBasedRecommender(dataModel, similarity);
   }
 

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarityTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarityTest.java?rev=712399&r1=712398&r2=712399&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarityTest.java
(original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/similarity/GenericItemSimilarityTest.java
Sat Nov  8 06:39:41 2008
@@ -35,13 +35,13 @@
     Item item2 = new GenericItem<String>("2");
     Item item3 = new GenericItem<String>("3");
     Item item4 = new GenericItem<String>("4");
-    List<GenericItemSimilarity.ItemItemCorrelation> correlations =
-            new ArrayList<GenericItemSimilarity.ItemItemCorrelation>(4);
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item2, 0.5));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item2, item1, 0.6));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item1, 0.5));
-    correlations.add(new GenericItemSimilarity.ItemItemCorrelation(item1, item3, 0.3));
-    GenericItemSimilarity itemCorrelation = new GenericItemSimilarity(correlations);
+    List<GenericItemSimilarity.ItemItemSimilarity> similarities =
+            new ArrayList<GenericItemSimilarity.ItemItemSimilarity>(4);
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item2, 0.5));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item2, item1, 0.6));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item1, 0.5));
+    similarities.add(new GenericItemSimilarity.ItemItemSimilarity(item1, item3, 0.3));
+    GenericItemSimilarity itemCorrelation = new GenericItemSimilarity(similarities);
     assertEquals(1.0, itemCorrelation.itemSimilarity(item1, item1));
     assertEquals(0.6, itemCorrelation.itemSimilarity(item1, item2));
     assertEquals(0.6, itemCorrelation.itemSimilarity(item2, item1));

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/transforms/CaseAmplificationTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/transforms/CaseAmplificationTest.java?rev=712399&r1=712398&r2=712399&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/transforms/CaseAmplificationTest.java
(original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/transforms/CaseAmplificationTest.java
Sat Nov  8 06:39:41 2008
@@ -23,8 +23,8 @@
 public final class CaseAmplificationTest extends TransformTestCase {
 
   public void testOneValue() {
-    assertEquals(2.0, new CaseAmplification(0.5).transformCorrelation(null, null, 4.0), EPSILON);
-    assertEquals(-2.0, new CaseAmplification(0.5).transformCorrelation(null, null, -4.0),
EPSILON);
+    assertEquals(2.0, new CaseAmplification(0.5).transformSimilarity(null, null, 4.0), EPSILON);
+    assertEquals(-2.0, new CaseAmplification(0.5).transformSimilarity(null, null, -4.0),
EPSILON);
   }
 
   public void testRefresh() {



Mime
View raw message