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

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

我正在执行以下命令,

  1. /mahout trainnb
  2. -i ${WORK_DIR}/20news-train-vectors -el
  3. -o ${WORK_DIR}/model
  4. -li ${WORK_DIR}/labelindex
  5. -ow
  6. ./mahout testnb
  7. -i ${WORK_DIR}/20news-test-vectors
  8. -m ${WORK_DIR}/model
  9. -l ${WORK_DIR}/labelindex\
  10. -ow -o ${WORK_DIR}/20news-testing

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

  1. Exception in thread "main" java.lang.IllegalArgumentException: Label not found: 10002
  2. at com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
  3. at org.apache.mahout.classifier.ConfusionMatrix.getCount(ConfusionMatrix.java:182)
  4. at org.apache.mahout.classifier.ConfusionMatrix.incrementCount(ConfusionMatrix.java: 205)
  5. at org.apache.mahout.classifier.ConfusionMatrix.incrementCount(ConfusionMatrix.java: 209)
  6. at org.apache.mahout.classifier.ConfusionMatrix.addInstance(ConfusionMatrix.java:173 )
  7. at org.apache.mahout.classifier.ResultAnalyzer.addInstance(ResultAnalyzer.java:70)
  8. at org.apache.mahout.classifier.naivebayes.test.TestNaiveBayesDriver.analyzeResults( TestNaiveBayesDriver.java:160)
  9. at org.apache.mahout.classifier.naivebayes.test.TestNaiveBayesDriver.run(TestNaiveBa yesDriver.java:125)
  10. at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
  11. at org.apache.mahout.classifier.naivebayes.test.TestNaiveBayesDriver.main(TestNaiveB ayesDriver.java:66)
  12. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  13. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  14. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java :43)
  15. at java.lang.reflect.Method.invoke(Method.java:606)
  16. at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java :72)
  17. at org.apache.hadoop.util.ProgramDriver.run(ProgramDriver.java:144)
  18. at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:152)
  19. at org.apache.mahout.driver.MahoutDriver.main(MahoutDriver.java:195)
  20. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  21. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  22. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java :43)
  23. at java.lang.reflect.Method.invoke(Method.java:606)
  24. 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版本。这可能会解决你的问题。

相关问题