mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r765534 - in /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model: BooleanPrefUser.java file/FileDataModel.java
Date Thu, 16 Apr 2009 09:22:21 GMT
Author: srowen
Date: Thu Apr 16 09:22:18 2009
New Revision: 765534

URL: http://svn.apache.org/viewvc?rev=765534&view=rev
Log:
... and the rest of the fix for last regression involving change to FileDataModel

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/BooleanPrefUser.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/BooleanPrefUser.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/BooleanPrefUser.java?rev=765534&r1=765533&r2=765534&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/BooleanPrefUser.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/BooleanPrefUser.java
Thu Apr 16 09:22:18 2009
@@ -23,6 +23,7 @@
 import org.apache.mahout.cf.taste.impl.common.ArrayIterator;
 
 import java.io.Serializable;
+import java.util.Arrays;
 
 /**
  * A variant of {@link GenericUser} which is appropriate when users express only a "yes"
preference for
@@ -64,6 +65,7 @@
       result[i] = buildPreference(itemID);
       i++;
     }
+    Arrays.sort(result, ByItemPreferenceComparator.getInstance());
     return result;
   }
 

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java?rev=765534&r1=765533&r2=765534&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
Thu Apr 16 09:22:18 2009
@@ -360,7 +360,7 @@
    *  are in fact {@link BooleanPreference}s
    */
   protected User buildUser(String id, List<Preference> prefs) {
-    if (!prefs.isEmpty() || prefs.get(0) instanceof BooleanPreference) {
+    if (!prefs.isEmpty() && prefs.get(0) instanceof BooleanPreference) {
       // If first is a BooleanPreference, assuming all are, so, want to use BooleanPrefUser
       FastSet<Object> itemIDs = new FastSet<Object>(prefs.size());
       for (Preference pref : prefs) {



Mime
View raw message