mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r1051426 - in /mahout/trunk: core/src/main/java/org/apache/mahout/cf/taste/impl/common/ core/src/main/java/org/apache/mahout/cf/taste/impl/model/ core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/ core/src/main/java/org/apache/...
Date Tue, 21 Dec 2010 09:17:42 GMT
Author: srowen
Date: Tue Dec 21 09:17:39 2010
New Revision: 1051426

URL: http://svn.apache.org/viewvc?rev=1051426&view=rev
Log:
Style / analysis changes, mostly correctly using the efficient nextLong() and @Override

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastIDSet.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/GenericBooleanPrefDataModel.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/FarthestNeighborClusterSimilarity.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommender.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/NearestNeighborClusterSimilarity.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/PreferredItemsNeighborhoodCandidateItemsStrategy.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/SamplingCandidateItemsStrategy.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TreeClusteringRecommender.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TreeClusteringRecommender2.java
    mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java
    mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java
    mahout/trunk/core/src/test/java/org/apache/mahout/clustering/minhash/TestMinHashClustering.java
    mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/DocumentProcessorTest.java
    mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorList.java
    mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java
    mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastIDSet.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastIDSet.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastIDSet.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastIDSet.java
Tue Dec 21 09:17:39 2010
@@ -137,6 +137,7 @@ public final class FastIDSet implements 
     return false;
   }
   
+  @Override
   public LongPrimitiveIterator iterator() {
     return new KeyIterator();
   }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/GenericBooleanPrefDataModel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/GenericBooleanPrefDataModel.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/GenericBooleanPrefDataModel.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/GenericBooleanPrefDataModel.java
Tue Dec 21 09:17:39 2010
@@ -82,7 +82,7 @@ public final class GenericBooleanPrefDat
       itemIDSet.addAll(itemIDs);
       LongPrimitiveIterator it = itemIDs.iterator();
       while (it.hasNext()) {
-        long itemID = it.next();
+        long itemID = it.nextLong();
         FastIDSet userIDs = preferenceForItems.get(itemID);
         if (userIDs == null) {
           userIDs = new FastIDSet(2);
@@ -188,7 +188,7 @@ public final class GenericBooleanPrefDat
     LongPrimitiveIterator it = itemIDs.iterator();
     while (it.hasNext()) {
       prefArray.setUserID(i, userID);
-      prefArray.setItemID(i, it.next());
+      prefArray.setItemID(i, it.nextLong());
       i++;
     }
     return prefArray;
@@ -218,7 +218,7 @@ public final class GenericBooleanPrefDat
     int i = 0;
     LongPrimitiveIterator it = userIDs.iterator();
     while (it.hasNext()) {
-      prefArray.setUserID(i, it.next());
+      prefArray.setUserID(i, it.nextLong());
       prefArray.setItemID(i, itemID);
       i++;
     }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/FarthestNeighborClusterSimilarity.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/FarthestNeighborClusterSimilarity.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/FarthestNeighborClusterSimilarity.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/FarthestNeighborClusterSimilarity.java
Tue Dec 21 09:17:39 2010
@@ -78,7 +78,7 @@ public final class FarthestNeighborClust
       long userID1 = someUsers.next();
       LongPrimitiveIterator it2 = cluster2.iterator();
       while (it2.hasNext()) {
-        double theSimilarity = similarity.userSimilarity(userID1, it2.next());
+        double theSimilarity = similarity.userSimilarity(userID1, it2.nextLong());
         if (theSimilarity < leastSimilarity) {
           leastSimilarity = theSimilarity;
         }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommender.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommender.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommender.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommender.java
Tue Dec 21 09:17:39 2010
@@ -159,9 +159,10 @@ public class GenericItemBasedRecommender
     return doMostSimilarItems(itemIDs, howMany, estimator);
   }
 
+  @Override
   public List<RecommendedItem> mostSimilarItems(long[] itemIDs,
-                                         int howMany,
-                                         boolean excludeItemIfNotSimilarToAll) throws TasteException
{
+                                                int howMany,
+                                                boolean excludeItemIfNotSimilarToAll) throws
TasteException {
     TopItems.Estimator<Long> estimator = new MultiMostSimilarEstimator(itemIDs, similarity,
null,
         excludeItemIfNotSimilarToAll);
     return doMostSimilarItems(itemIDs, howMany, estimator);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/NearestNeighborClusterSimilarity.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/NearestNeighborClusterSimilarity.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/NearestNeighborClusterSimilarity.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/NearestNeighborClusterSimilarity.java
Tue Dec 21 09:17:39 2010
@@ -78,7 +78,7 @@ public final class NearestNeighborCluste
       long userID1 = someUsers.next();
       LongPrimitiveIterator it2 = cluster2.iterator();
       while (it2.hasNext()) {
-        double theSimilarity = similarity.userSimilarity(userID1, it2.next());
+        double theSimilarity = similarity.userSimilarity(userID1, it2.nextLong());
         if (theSimilarity > greatestSimilarity) {
           greatestSimilarity = theSimilarity;
         }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/PreferredItemsNeighborhoodCandidateItemsStrategy.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/PreferredItemsNeighborhoodCandidateItemsStrategy.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/PreferredItemsNeighborhoodCandidateItemsStrategy.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/PreferredItemsNeighborhoodCandidateItemsStrategy.java
Tue Dec 21 09:17:39 2010
@@ -36,7 +36,7 @@ public final class PreferredItemsNeighbo
     FastIDSet itemIDs = dataModel.getItemIDsFromUser(userID);
     LongPrimitiveIterator itemIDIterator = itemIDs.iterator();
     while (itemIDIterator.hasNext()) {
-      long itemID = itemIDIterator.next();
+      long itemID = itemIDIterator.nextLong();
       PreferenceArray prefs2 = dataModel.getPreferencesForItem(itemID);
       int size2 = prefs2.length();
       for (int j = 0; j < size2; j++) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/SamplingCandidateItemsStrategy.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/SamplingCandidateItemsStrategy.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/SamplingCandidateItemsStrategy.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/SamplingCandidateItemsStrategy.java
Tue Dec 21 09:17:39 2010
@@ -74,7 +74,7 @@ public class SamplingCandidateItemsStrat
     FastIDSet itemIDs = dataModel.getItemIDsFromUser(userID);
     LongPrimitiveIterator itemIDIterator = itemIDs.iterator();
     while (itemIDIterator.hasNext()) {
-      long itemID = itemIDIterator.next();
+      long itemID = itemIDIterator.nextLong();
       PreferenceArray prefs = dataModel.getPreferencesForItem(itemID);
       int prefsConsidered = Math.min(prefs.length(), maxPrefsPerItemConsidered);
       Iterator<Preference> sampledPrefs = new FixedSizeSamplingIterator(prefsConsidered,
prefs.iterator());

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TreeClusteringRecommender.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TreeClusteringRecommender.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TreeClusteringRecommender.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TreeClusteringRecommender.java
Tue Dec 21 09:17:39 2010
@@ -344,7 +344,7 @@ public final class TreeClusteringRecomme
       List<RecommendedItem> recs = computeTopRecsForCluster(cluster);
       LongPrimitiveIterator it = cluster.iterator();
       while (it.hasNext()) {
-        recsPerUser.put(it.next(), recs);
+        recsPerUser.put(it.nextLong(), recs);
       }
     }
     return recsPerUser;
@@ -355,7 +355,7 @@ public final class TreeClusteringRecomme
     FastIDSet possibleItemIDs = new FastIDSet();
     LongPrimitiveIterator it = cluster.iterator();
     while (it.hasNext()) {
-      possibleItemIDs.addAll(dataModel.getItemIDsFromUser(it.next()));
+      possibleItemIDs.addAll(dataModel.getItemIDsFromUser(it.nextLong()));
     }
     
     TopItems.Estimator<Long> estimator = new Estimator(cluster);
@@ -372,7 +372,7 @@ public final class TreeClusteringRecomme
     for (FastIDSet cluster : clusters) {
       LongPrimitiveIterator it = cluster.iterator();
       while (it.hasNext()) {
-        clustersPerUser.put(it.next(), cluster);
+        clustersPerUser.put(it.nextLong(), cluster);
       }
     }
     return clustersPerUser;
@@ -402,7 +402,7 @@ public final class TreeClusteringRecomme
       RunningAverage average = new FullRunningAverage();
       LongPrimitiveIterator it = cluster.iterator();
       while (it.hasNext()) {
-        Float pref = dataModel.getPreferenceValue(it.next(), itemID);
+        Float pref = dataModel.getPreferenceValue(it.nextLong(), itemID);
         if (pref != null) {
           average.addDatum(pref);
         }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TreeClusteringRecommender2.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TreeClusteringRecommender2.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TreeClusteringRecommender2.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/TreeClusteringRecommender2.java
Tue Dec 21 09:17:39 2010
@@ -411,7 +411,7 @@ public final class TreeClusteringRecomme
       List<RecommendedItem> recs = computeTopRecsForCluster(cluster);
       LongPrimitiveIterator it = cluster.iterator();
       while (it.hasNext()) {
-        recsPerUser.put(it.next(), recs);
+        recsPerUser.put(it.nextLong(), recs);
       }
     }
     return recsPerUser;
@@ -423,7 +423,7 @@ public final class TreeClusteringRecomme
     FastIDSet possibleItemIDs = new FastIDSet();
     LongPrimitiveIterator it = cluster.iterator();
     while (it.hasNext()) {
-      possibleItemIDs.addAll(dataModel.getItemIDsFromUser(it.next()));
+      possibleItemIDs.addAll(dataModel.getItemIDsFromUser(it.nextLong()));
     }
     
     TopItems.Estimator<Long> estimator = new Estimator(cluster);
@@ -440,7 +440,7 @@ public final class TreeClusteringRecomme
     for (FastIDSet cluster : clusters) {
       LongPrimitiveIterator it = cluster.iterator();
       while (it.hasNext()) {
-        clustersPerUser.put(it.next(), cluster);
+        clustersPerUser.put(it.nextLong(), cluster);
       }
     }
     return clustersPerUser;
@@ -470,7 +470,7 @@ public final class TreeClusteringRecomme
       RunningAverage average = new FullRunningAverage();
       LongPrimitiveIterator it = cluster.iterator();
       while (it.hasNext()) {
-        Float pref = dataModel.getPreferenceValue(it.next(), itemID);
+        Float pref = dataModel.getPreferenceValue(it.nextLong(), itemID);
         if (pref != null) {
           average.addDatum(pref);
         }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java Tue
Dec 21 09:17:39 2010
@@ -176,9 +176,9 @@ public class Step0Job {
     }
     
     // update the values' first ids
-    for (int p = 0; p < numMaps; p++) {
-      int order = ArrayUtils.indexOf(sorted, values.get(p));
-      values.get(p).firstId = orderedIds[order];
+    for (Step0Output value : values) {
+      int order = ArrayUtils.indexOf(sorted, value);
+      value.firstId = orderedIds[order];
     }
     
     // reorder the values in hadoop's order

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java Tue
Dec 21 09:17:39 2010
@@ -374,15 +374,13 @@ public final class TransactionTree imple
       int transactionSetSize = transactionSet.size();
       vInt.set(transactionSetSize);
       vInt.write(out);
-      for (int i = 0; i < transactionSetSize; i++) {
-        Pair<List<Integer>,Long> transaction = transactionSet.get(i);
-        
+      for (Pair<List<Integer>, Long> transaction : transactionSet) {
         vLong.set(transaction.getSecond());
         vLong.write(out);
-        
+
         vInt.set(transaction.getFirst().size());
         vInt.write(out);
-        
+
         for (Integer item : transaction.getFirst()) {
           vInt.set(item);
           vInt.write(out);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java
Tue Dec 21 09:17:39 2010
@@ -295,7 +295,7 @@ public class EigenVerificationJob extend
 
     eigenVerifier = new SimpleEigenVerifier();
     //OrthonormalityVerifier orthoVerifier = new OrthonormalityVerifier();
-    VectorIterable pairwiseInnerProducts = computePairwiseInnerProducts();
+    //VectorIterable pairwiseInnerProducts = computePairwiseInnerProducts();
     // FIXME: Why is the above vector computed if it is never used?
 
     Map<MatrixSlice, EigenStatus> eigenMetaData = verifyEigens();

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/minhash/TestMinHashClustering.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/minhash/TestMinHashClustering.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/minhash/TestMinHashClustering.java
(original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/minhash/TestMinHashClustering.java
Tue Dec 21 09:17:39 2010
@@ -103,13 +103,13 @@ public class TestMinHashClustering exten
     return values;
   }
   
-  private void runPairwiseSimilarity(List<Vector> clusteredItems, double simThreshold,
String msg) {
+  private static void runPairwiseSimilarity(List<Vector> clusteredItems, double simThreshold,
String msg) {
     if (clusteredItems.size() > 1) {
       for (int i = 0; i < clusteredItems.size(); i++) {
         Set<Integer> itemSet1 = getValues(clusteredItems.get(i));
         for (int j = i + 1; j < clusteredItems.size(); j++) {
           Set<Integer> itemSet2 = getValues(clusteredItems.get(j));
-          Set<Integer> union = new HashSet<Integer>();
+          Collection<Integer> union = new HashSet<Integer>();
           union.addAll(itemSet1);
           union.addAll(itemSet2);
           Collection<Integer> intersect = new HashSet<Integer>();

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/DocumentProcessorTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/DocumentProcessorTest.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/DocumentProcessorTest.java
(original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/DocumentProcessorTest.java
Tue Dec 21 09:17:39 2010
@@ -27,11 +27,11 @@ public class DocumentProcessorTest exten
 
     String documentId1 = "123";
     String text1 = "A test for the document processor";
-    String documentId2 = "456";
-    String text2 = "and another one";
 
     SequenceFile.Writer writer = new SequenceFile.Writer(fs, configuration, input, Text.class,
Text.class);
     writer.append(new Text(documentId1), new Text(text1));
+    String documentId2 = "456";
+    String text2 = "and another one";
     writer.append(new Text(documentId2), new Text(text2));
     writer.close();
 

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorList.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorList.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorList.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorList.java Tue Dec 21 09:17:39
2010
@@ -190,7 +190,7 @@ public class VectorList extends Abstract
    */
   public Matrix like() {
     VectorList r = new VectorList(columns);
-    int i = 0;
+    //int i = 0;
     for (Vector vector : data) {
       r.adjoinRow(vector.like());
     }

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java Tue
Dec 21 09:17:39 2010
@@ -17,6 +17,7 @@
 
 package org.apache.mahout.math.decomposer;
 
+import org.apache.mahout.common.RandomUtils;
 import org.apache.mahout.math.MahoutTestCase;
 import org.apache.mahout.math.Matrix;
 import org.apache.mahout.math.SequentialAccessSparseVector;
@@ -83,7 +84,7 @@ public abstract class SolverTest extends
                                                           double entryMean) {
     SparseRowMatrix m = new SparseRowMatrix(new int[]{numRows, numCols});
     //double n = 0;
-    Random r = new Random(1234L);
+    Random r = RandomUtils.getRandom();
     for (int i = 0; i < nonNullRows; i++) {
       SequentialAccessSparseVector v = new SequentialAccessSparseVector(numCols);
       for (int j = 0; j < entriesPerRow; j++) {

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java?rev=1051426&r1=1051425&r2=1051426&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java
(original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java
Tue Dec 21 09:17:39 2010
@@ -247,9 +247,9 @@ public class CDbwEvaluator {
       int r = repPtsI.size();
       double sumJ = 0.0;
       // compute the term density (eqn 6)
-      for (int j = 0; j < r; j++) {
+      for (VectorWritable pt : repPtsI) {
         // compute f(x, vIJ) (eqn 7)
-        Vector repJ = repPtsI.get(j).get();
+        Vector repJ = pt.get();
         double densityIJ = (measure.distance(cluster.getCenter(), repJ) <= stdev ? 1.0
: 0.0);
         // accumulate sumJ
         sumJ += densityIJ / stdev;



Mime
View raw message