mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robina...@apache.org
Subject svn commit: r915068 - /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/CosineDistanceMeasure.java
Date Mon, 22 Feb 2010 21:14:06 GMT
Author: robinanil
Date: Mon Feb 22 21:14:06 2010
New Revision: 915068

URL: http://svn.apache.org/viewvc?rev=915068&view=rev
Log:
Cosine Distance measure should use smaller vector to iterate

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/CosineDistanceMeasure.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/CosineDistanceMeasure.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/CosineDistanceMeasure.java?rev=915068&r1=915067&r2=915068&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/CosineDistanceMeasure.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/CosineDistanceMeasure.java
Mon Feb 22 21:14:06 2010
@@ -73,7 +73,7 @@
     double lengthSquaredv1 = v1.getLengthSquared();
     double lengthSquaredv2 = v2.getLengthSquared();
     
-    double dotProduct = v1.dot(v2);
+    double dotProduct = v2.dot(v1);
     double denominator = Math.sqrt(lengthSquaredv1) * Math.sqrt(lengthSquaredv2);
     
     // correct for floating-point rounding errors
@@ -89,7 +89,7 @@
 
     double lengthSquaredv =  v.getLengthSquared();
     
-    double dotProduct = centroid.dot(v);
+    double dotProduct = v.dot(centroid);
     double denominator = Math.sqrt(centroidLengthSquare) * Math.sqrt(lengthSquaredv);
     
     // correct for floating-point rounding errors



Mime
View raw message