mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r1136186 - /mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java
Date Wed, 15 Jun 2011 20:42:47 GMT
Author: srowen
Date: Wed Jun 15 20:42:47 2011
New Revision: 1136186

URL: http://svn.apache.org/viewvc?rev=1136186&view=rev
Log:
Avoid int overflow, per user report on mailling list

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java?rev=1136186&r1=1136185&r2=1136186&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java
Wed Jun 15 20:42:47 2011
@@ -101,7 +101,8 @@ public class BayesFeatureMapper extends 
     wordList.forEachPair(new ObjectIntProcedure<String>() {
       @Override
       public boolean apply(String word, int dKJ) {
-        lengthNormalisationMut.add(dKJ * dKJ);
+        long squared = (long) dKJ * (long) dKJ;
+        lengthNormalisationMut.add(squared);
         return true;
       }
     });



Mime
View raw message