fredang / mahout-naive-bayes-example

47 stars 42 forks source link

Exception running example #3

Closed rockwotj closed 7 years ago

rockwotj commented 8 years ago

Hello, I followed your example and am getting the following error, do you happen to have any insight on what is causing it or how to fix it?

Exception in thread "main" java.lang.IllegalArgumentException: Unknown flags set: %d [-101110]
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:115)
    at org.apache.mahout.math.VectorWritable.readFields(VectorWritable.java:88)
    at org.apache.mahout.math.VectorWritable.readVector(VectorWritable.java:199)
    at org.apache.mahout.classifier.naivebayes.NaiveBayesModel.materialize(NaiveBayesModel.java:112)
    at edu.rosehulman.mahout.Classifier.main(Classifier.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
fabianomichels commented 8 years ago

Check Sandeepan Jindal's comment at https://chimpler.wordpress.com/2013/03/13/using-the-mahout-naive-bayes-classifier-to-automatically-classify-twitter-messages/:

Sandeepan Jindal says: 2015/09/19 at 7:08 am I was facing the same issue. Fixing the pom.xml file fixed it for me.

Remove all the dependencies and use the ones below. From mahout 0.10, they have partitioned mahout-core.jar into mahout-mr and mahout-hdfs.

org.apache.mahout mahout-mr 0.11.0

org.apache.mahout mahout-hdfs 0.11.0

org.apache.mahout mahout-math 0.11.0

It worked for me (used 0.11.1)