mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r1378671 - /mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/Factorization.java
Date Wed, 29 Aug 2012 18:26:21 GMT
Author: ssc
Date: Wed Aug 29 18:26:21 2012
New Revision: 1378671

URL: http://svn.apache.org/viewvc?rev=1378671&view=rev
Log:
more getters for a factorization (minor change)

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/Factorization.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/Factorization.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/Factorization.java?rev=1378671&r1=1378670&r2=1378671&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/Factorization.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/Factorization.java
Wed Aug 29 18:26:21 2012
@@ -48,6 +48,10 @@ public class Factorization {
     this.itemFeatures = itemFeatures;
   }
 
+  public double[][] allUserFeatures() {
+    return userFeatures;
+  }
+
   public double[] getUserFeatures(long userID) throws NoSuchUserException {
     Integer index = userIDMapping.get(userID);
     if (index == null) {
@@ -56,6 +60,10 @@ public class Factorization {
     return userFeatures[index];
   }
 
+  public double[][] allItemFeatures() {
+    return itemFeatures;
+  }
+
   public double[] getItemFeatures(long itemID) throws NoSuchItemException {
     Integer index = itemIDMapping.get(itemID);
     if (index == null) {
@@ -64,10 +72,26 @@ public class Factorization {
     return itemFeatures[index];
   }
 
+  public int userIndex(long userID) throws NoSuchUserException {
+    Integer index = userIDMapping.get(userID);
+    if (index == null) {
+      throw new NoSuchUserException(userID);
+    }
+    return index;
+  }
+
   public Iterable<Map.Entry<Long,Integer>> getUserIDMappings() {
     return userIDMapping.entrySet();
   }
 
+  public int itemIndex(long itemID) throws NoSuchItemException {
+    Integer index = itemIDMapping.get(itemID);
+    if (index == null) {
+      throw new NoSuchItemException(itemID);
+    }
+    return index;
+  }
+
   public Iterable<Map.Entry<Long,Integer>> getItemIDMappings() {
     return itemIDMapping.entrySet();
   }



Mime
View raw message