mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r765043 - /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TopItems.java
Date Wed, 15 Apr 2009 04:10:02 GMT
Author: srowen
Date: Wed Apr 15 04:10:02 2009
New Revision: 765043

URL: http://svn.apache.org/viewvc?rev=765043&view=rev
Log:
Should omit similarity pairs whose value is NaN

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

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TopItems.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TopItems.java?rev=765043&r1=765042&r2=765043&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TopItems.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TopItems.java
Wed Apr 15 04:10:02 2009
@@ -120,7 +120,7 @@
     double lowestTopValue = Double.NEGATIVE_INFINITY;
     for (GenericItemSimilarity.ItemItemSimilarity similarity : allSimilarities) {
       double value = similarity.getValue();
-      if (!full || value > lowestTopValue) {
+      if (!Double.isNaN(value) && (!full || value > lowestTopValue)) {
         topSimilarities.add(similarity);
         if (full) {
           topSimilarities.poll();
@@ -146,7 +146,7 @@
     double lowestTopValue = Double.NEGATIVE_INFINITY;
     for (GenericUserSimilarity.UserUserSimilarity similarity : allSimilarities) {
       double value = similarity.getValue();
-      if (!full || value > lowestTopValue) {
+      if (!Double.isNaN(value) && (!full || value > lowestTopValue)) {
         topSimilarities.add(similarity);
         if (full) {
           topSimilarities.poll();
@@ -165,7 +165,6 @@
   }
 
   public interface Estimator<T> {
-
     double estimate(T thing) throws TasteException;
   }
 



Mime
View raw message