Skip to content

Instantly share code, notes, and snippets.

@dfilimon
dfilimon / StreamingKMeansFailure.txt
Created December 5, 2012 23:17
StreamingKMeans failure for 10 dimensions
org.apache.mahout.knn.search.ProjectionSearch org.apache.mahout.common.distance.EuclideanDistanceMeasure
Total number of clusters 344
java.lang.AssertionError: Maximum weight too large 1.4078472959685535
at org.junit.Assert.fail(Assert.java:91)
at org.junit.Assert.assertTrue(Assert.java:43)
at org.apache.mahout.knn.cluster.StreamingKMeansTest.testClustering(StreamingKMeansTest.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
@dfilimon
dfilimon / AbstractSymbolTest.java
Created November 12, 2012 13:03
AbstractSymbol not hashable properly
import static org.junit.Assert.*;
import java.util.Set;
import org.junit.Test;
import com.google.common.collect.Sets;
public class AbstractSymbolTest {
@dfilimon
dfilimon / BasicKMeans.java
Created November 8, 2012 13:13
This compiles file, but I'm having classpath issues.
package org.apache.mahout.knn.experimental;
import com.google.common.collect.Lists;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.SequenceFile;
import org.apache.hadoop.io.Text;
@dfilimon
dfilimon / GView.java
Created October 17, 2012 21:27
Add this after Gview.java:380 to enjoy anti-aliased placeholder text in your ANTLRWorks diagram viewer.
g.setFont(new Font(AWPrefs.getEditorFont(), Font.PLAIN, 2 * AWPrefs.getEditorFontSize()));
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
@dfilimon
dfilimon / ATETextPane.java
Created October 17, 2012 21:08
Add this after ATETextPane.java:137 to enjoy anti-aliased text in your ANTLWorks editor! :)
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
@dfilimon
dfilimon / jeopy_ip.py
Created December 4, 2010 12:58
Getting all IP addresses of a particular machine in Python. Unfortunately it doesn't work properly in Linux without a properly configured /etc/hosts file.
self.ip = [ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][0]