mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdunn...@apache.org
Subject svn commit: r1160100 - in /mahout/trunk: core/src/main/java/org/apache/mahout/clustering/minhash/ core/src/main/java/org/apache/mahout/vectorizer/encoders/ core/src/test/java/org/apache/mahout/vectorizer/encoders/ math/src/main/java/org/apache/mahout/m...
Date Mon, 22 Aug 2011 03:28:15 GMT
Author: tdunning
Date: Mon Aug 22 03:28:15 2011
New Revision: 1160100

URL: http://svn.apache.org/viewvc?rev=1160100&view=rev
Log:
MAHOUT-793 - move MurmurHash to math module

Added:
    mahout/trunk/math/src/main/java/org/apache/mahout/math/MurmurHash.java
      - copied, changed from r1160069, mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/MurmurHash.java
    mahout/trunk/math/src/test/java/org/apache/mahout/math/MurmurHashTest.java
      - copied, changed from r1160069, mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/encoders/MurmurHashTest.java
Removed:
    mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/MurmurHash.java
    mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/encoders/MurmurHashTest.java
Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/HashFactory.java
    mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/CachingValueEncoder.java
    mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/FeatureVectorEncoder.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/HashFactory.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/HashFactory.java?rev=1160100&r1=1160099&r2=1160100&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/HashFactory.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/minhash/HashFactory.java
Mon Aug 22 03:28:15 2011
@@ -17,7 +17,7 @@
 package org.apache.mahout.clustering.minhash;
 
 import org.apache.mahout.common.RandomUtils;
-import org.apache.mahout.vectorizer.encoders.MurmurHash;
+import org.apache.mahout.math.MurmurHash;
 
 import java.util.Random;
 

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/CachingValueEncoder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/CachingValueEncoder.java?rev=1160100&r1=1160099&r2=1160100&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/CachingValueEncoder.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/CachingValueEncoder.java
Mon Aug 22 03:28:15 2011
@@ -17,6 +17,8 @@
 
 package org.apache.mahout.vectorizer.encoders;
 
+import org.apache.mahout.math.MurmurHash;
+
 /**
  * Provides basic hashing semantics for encoders where the probe locations
  * depend only on the name of the variable.

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/FeatureVectorEncoder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/FeatureVectorEncoder.java?rev=1160100&r1=1160099&r2=1160100&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/FeatureVectorEncoder.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/FeatureVectorEncoder.java
Mon Aug 22 03:28:15 2011
@@ -19,6 +19,7 @@ package org.apache.mahout.vectorizer.enc
 
 import com.google.common.base.Charsets;
 import com.google.common.collect.Sets;
+import org.apache.mahout.math.MurmurHash;
 import org.apache.mahout.math.Vector;
 
 import java.util.Collections;

Copied: mahout/trunk/math/src/main/java/org/apache/mahout/math/MurmurHash.java (from r1160069,
mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/MurmurHash.java)
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/MurmurHash.java?p2=mahout/trunk/math/src/main/java/org/apache/mahout/math/MurmurHash.java&p1=mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/MurmurHash.java&r1=1160069&r2=1160100&rev=1160100&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/encoders/MurmurHash.java
(original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/MurmurHash.java Mon Aug 22 03:28:15
2011
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.mahout.vectorizer.encoders;
+package org.apache.mahout.math;
 
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;

Copied: mahout/trunk/math/src/test/java/org/apache/mahout/math/MurmurHashTest.java (from r1160069,
mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/encoders/MurmurHashTest.java)
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/MurmurHashTest.java?p2=mahout/trunk/math/src/test/java/org/apache/mahout/math/MurmurHashTest.java&p1=mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/encoders/MurmurHashTest.java&r1=1160069&r2=1160100&rev=1160100&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/encoders/MurmurHashTest.java
(original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/MurmurHashTest.java Mon Aug 22
03:28:15 2011
@@ -15,29 +15,30 @@
  * limitations under the License.
  */
 
-package org.apache.mahout.vectorizer.encoders;
+package org.apache.mahout.math;
 
 import com.google.common.base.Charsets;
-import org.apache.mahout.common.MahoutTestCase;
+import org.junit.Assert;
 import org.junit.Test;
 
 import java.io.UnsupportedEncodingException;
 
-public class MurmurHashTest extends MahoutTestCase {
+public class MurmurHashTest extends org.apache.mahout.math.MahoutTestCase {
+
   @Test
   public void testForLotsOfChange64() throws UnsupportedEncodingException {
     long h1 = MurmurHash.hash64A("abc".getBytes(Charsets.UTF_8), 0);
     long h2 = MurmurHash.hash64A("abc ".getBytes(Charsets.UTF_8), 0);
     int flipCount = Long.bitCount(h1 ^ h2);
-    assertTrue("Small changes should result in lots of bit flips, only found " + flipCount,
flipCount > 25);
+    Assert.assertTrue("Small changes should result in lots of bit flips, only found " + flipCount,
flipCount > 25);
   }
 
   @Test
   public void testHash64() {
     // test data generated by running MurmurHash2_64.cpp
-    assertEquals(0x9cc9c33498a95efbL, MurmurHash.hash64A("abc".getBytes(Charsets.UTF_8),
0));
-    assertEquals(0xd2c8c9b470122bddL, MurmurHash.hash64A("abc def ghi jkl ".getBytes(Charsets.UTF_8),
0));
-    assertEquals(0xcd37895736a81cbcL, MurmurHash.hash64A("abc def ghi jkl moreGoo".getBytes(Charsets.UTF_8),
0));
+    Assert.assertEquals(0x9cc9c33498a95efbL, MurmurHash.hash64A("abc".getBytes(Charsets.UTF_8),
0));
+    Assert.assertEquals(0xd2c8c9b470122bddL, MurmurHash.hash64A("abc def ghi jkl ".getBytes(Charsets.UTF_8),
0));
+    Assert.assertEquals(0xcd37895736a81cbcL, MurmurHash.hash64A("abc def ghi jkl moreGoo".getBytes(Charsets.UTF_8),
0));
   }
 
   @Test
@@ -45,7 +46,7 @@ public class MurmurHashTest extends Maho
     int h1 = MurmurHash.hash("abc".getBytes(Charsets.UTF_8), 0);
     int h2 = MurmurHash.hash("abc ".getBytes(Charsets.UTF_8), 0);
     int flipCount = Integer.bitCount(h1 ^ h2);
-    assertTrue("Small changes should result in lots of bit flips, only found " + flipCount,
flipCount > 14);
+    Assert.assertTrue("Small changes should result in lots of bit flips, only found " + flipCount,
flipCount > 14);
   }
 
   // tests lifted from http://dmy999.com/article/50/murmurhash-2-java-port
@@ -68,7 +69,7 @@ public class MurmurHashTest extends Maho
     for (int i = 0; i < expected.length; i++) {
       int expectedHash = expected[i];
       int hash = MurmurHash.hash(key, i);
-      assertEquals("i = " + i, expectedHash, hash);
+      Assert.assertEquals("i = " + i, expectedHash, hash);
     }
   }
 
@@ -85,7 +86,7 @@ public class MurmurHashTest extends Maho
       setKey(key, i);
       int expectedHash = expected[i];
       int hash = MurmurHash.hash(key, 0x1234ABCD);
-      assertEquals("i = " + i, expectedHash, hash);
+      Assert.assertEquals("i = " + i, expectedHash, hash);
     }
   }
 
@@ -101,7 +102,7 @@ public class MurmurHashTest extends Maho
       setKey(key, i);
       int expectedHash = expected[i];
       int hash = MurmurHash.hash(key, 0x7870AAFF);
-      assertEquals("i = " + i, expectedHash, hash);
+      Assert.assertEquals("i = " + i, expectedHash, hash);
     }
   }
 



Mime
View raw message