mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r1588656 - in /mahout/trunk: CHANGELOG mrlegacy/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/ALSWRFactorizer.java
Date Sat, 19 Apr 2014 14:31:03 GMT
Author: ssc
Date: Sat Apr 19 14:31:03 2014
New Revision: 1588656

URL: http://svn.apache.org/r1588656
Log:
MAHOUT-1517 Remove casts to int in ALSWRFactorizer

Modified:
    mahout/trunk/CHANGELOG
    mahout/trunk/mrlegacy/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/ALSWRFactorizer.java

Modified: mahout/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/mahout/trunk/CHANGELOG?rev=1588656&r1=1588655&r2=1588656&view=diff
==============================================================================
--- mahout/trunk/CHANGELOG (original)
+++ mahout/trunk/CHANGELOG Sat Apr 19 14:31:03 2014
@@ -2,6 +2,9 @@ Mahout Change Log
 
 Release 1.0 - unreleased
 
+
+  MAHOUT-1517: Remove casts to int in ALSWRFactorizer (ssc)
+  
   MAHOUT-1425: SGD classifier example with bank marketing dataset. (frankscholten)
 
   MAHOUT-1511: Renaming core to mrlegacy (frankscholten)

Modified: mahout/trunk/mrlegacy/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/ALSWRFactorizer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/mrlegacy/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/ALSWRFactorizer.java?rev=1588656&r1=1588655&r2=1588656&view=diff
==============================================================================
--- mahout/trunk/mrlegacy/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/ALSWRFactorizer.java
(original)
+++ mahout/trunk/mrlegacy/src/main/java/org/apache/mahout/cf/taste/impl/recommender/svd/ALSWRFactorizer.java
Sat Apr 19 14:31:03 2014
@@ -275,7 +275,8 @@ public class ALSWRFactorizer extends Abs
     OpenIntObjectHashMap<Vector> mapping = new OpenIntObjectHashMap<Vector>(numItems);
     while (itemIDs.hasNext()) {
       long itemID = itemIDs.next();
-      mapping.put((int) itemID, new DenseVector(featureMatrix[itemIndex(itemID)], true));
+      int itemIndex = itemIndex(itemID);
+      mapping.put(itemIndex, new DenseVector(featureMatrix[itemIndex(itemID)], true));
     }
 
     return mapping;
@@ -287,7 +288,8 @@ public class ALSWRFactorizer extends Abs
 
     while (userIDs.hasNext()) {
       long userID = userIDs.next();
-      mapping.put((int) userID, new DenseVector(featureMatrix[userIndex(userID)], true));
+      int userIndex = userIndex(userID);
+      mapping.put(userIndex, new DenseVector(featureMatrix[userIndex(userID)], true));
     }
 
     return mapping;
@@ -296,7 +298,7 @@ public class ALSWRFactorizer extends Abs
   protected Vector sparseItemRatingVector(PreferenceArray prefs) {
     SequentialAccessSparseVector ratings = new SequentialAccessSparseVector(Integer.MAX_VALUE,
prefs.length());
     for (Preference preference : prefs) {
-      ratings.set((int) preference.getUserID(), preference.getValue());
+      ratings.set(userIndex(preference.getUserID()), preference.getValue());
     }
     return ratings;
   }
@@ -304,7 +306,7 @@ public class ALSWRFactorizer extends Abs
   protected Vector sparseUserRatingVector(PreferenceArray prefs) {
     SequentialAccessSparseVector ratings = new SequentialAccessSparseVector(Integer.MAX_VALUE,
prefs.length());
     for (Preference preference : prefs) {
-      ratings.set((int) preference.getItemID(), preference.getValue());
+      ratings.set(itemIndex(preference.getItemID()), preference.getValue());
     }
     return ratings;
   }



Mime
View raw message