exception-java.lang.illegalargumentexception:在mahout中找不到标签

knsnq2tg  于 2021-06-03  发布在  Hadoop
关注(0)|答案(2)|浏览(449)

我正在执行以下命令,

/mahout trainnb 
    -i ${WORK_DIR}/20news-train-vectors -el 
    -o ${WORK_DIR}/model 
    -li ${WORK_DIR}/labelindex 
    -ow

./mahout testnb 
    -i ${WORK_DIR}/20news-test-vectors
    -m ${WORK_DIR}/model 
    -l ${WORK_DIR}/labelindex\
    -ow -o ${WORK_DIR}/20news-testing

在运行最后一个命令时,我能够将map任务运行到100%,但是在reduce任务时,我得到以下错误:

Exception in thread "main" java.lang.IllegalArgumentException: Label not found: 10002
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
        at org.apache.mahout.classifier.ConfusionMatrix.getCount(ConfusionMatrix.java:182)
        at org.apache.mahout.classifier.ConfusionMatrix.incrementCount(ConfusionMatrix.java:                205)
        at org.apache.mahout.classifier.ConfusionMatrix.incrementCount(ConfusionMatrix.java:                209)
        at org.apache.mahout.classifier.ConfusionMatrix.addInstance(ConfusionMatrix.java:173                )
        at org.apache.mahout.classifier.ResultAnalyzer.addInstance(ResultAnalyzer.java:70)
        at org.apache.mahout.classifier.naivebayes.test.TestNaiveBayesDriver.analyzeResults(                TestNaiveBayesDriver.java:160)
        at org.apache.mahout.classifier.naivebayes.test.TestNaiveBayesDriver.run(TestNaiveBa                yesDriver.java:125)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
        at org.apache.mahout.classifier.naivebayes.test.TestNaiveBayesDriver.main(TestNaiveB                ayesDriver.java:66)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java                :43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java                :72)
        at org.apache.hadoop.util.ProgramDriver.run(ProgramDriver.java:144)
        at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:152)
        at org.apache.mahout.driver.MahoutDriver.main(MahoutDriver.java:195)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java                :43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

我在学习http://www.packtpub.com/article/implementing-the-na%c3%afve-bayes-classifier-in-mahout 还尝试了labelindex上的seqdumper,可以看到其中的键和值。
我使用的是hadoop2.2和mahout1.0,整个环境都是在amazonec2上设置的。
请帮帮我。我做错什么了吗?

sqxo8psd

sqxo8psd1#

我猜你的档案在本地。我也有这个问题,我修正了它,当我把文件改成hdfs

j13ufse2

j13ufse22#

我认为mahout与您的hadoop版本不兼容,您应该下载hadoop的1.1.0或1.2.0版本。这可能会解决你的问题。

相关问题