我正在尝试使用 Mahout 中的朴素贝叶斯分类器对一些产品数据进行分类。
我曾经solr
将两个数据集都转换为 lucene 索引,然后使用 Mahout split 命令创建训练集和保持集。这似乎工作正常。
现在我已经到了用 trainnb 训练朴素贝叶斯模型的阶段,但我收到以下错误:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
at org.apache.mahout.classifier.naivebayes.BayesUtils.writeLabelIndex(BayesUtils.java:119)
at org.apache.mahout.classifier.naivebayes.training.TrainNaiveBayesJob.createLabelIndex(TrainNaiveBayesJob.java:152)
at org.apache.mahout.classifier.naivebayes.training.TrainNaiveBayesJob.run(TrainNaiveBayesJob.java:92)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.mahout.classifier.naivebayes.training.TrainNaiveBayesJob.main(TrainNaiveBayesJob.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:68)
at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:139)
at org.apache.mahout.driver.MahoutDriver.main(MahoutDriver.java:195)
这是我的命令输入:
$MAHOUT_HOME/bin/./mahout trainnb -i ~/training_output/Amazon_training_output/ -el -o ~/model/Amazon -li ~/labelindex/Amazon -ow -c
在这种情况下,错误是什么意思,我该如何解决?
有没有可能是我原来的索引是罪魁祸首?