【问题标题】:Error while creating mahout model创建 mahout 模型时出错
【发布时间】:2012-12-18 13:56:21
【问题描述】:

我正在为我的数据训练 mahout 分类器, 按照我发出的创建 mahout 模型的命令

./bin/mahout seqdirectory -i /tmp/mahout-work-root/MyData-all -o /tmp/mahout-work-root/MyData-seq

./bin/mahout seq2sparse -i /tmp/mahout-work-root/MyData-seq -o /tmp/mahout-work-root/MyData-vectors -lnorm -nv -wt tfidf

./bin/mahout split -i /tmp/mahout-work-root/MyData-vectors/tfidf-vectors --trainingOutput /tmp/mahout-work-root/MyData-train-vectors --testOutput /tmp/mahout-work-root/MyData-test-vectors --randomSelectionPct 40 --overwrite --sequenceFiles -xm sequential

./bin/mahout trainnb -i /tmp/mahout-work-root/Mydata-train-vectors -el -o /tmp/mahout-work-root/model -li /tmp/mahout-work-root/labelindex -ow

当我尝试使用 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)

这可能是什么问题?

注意:提到的原始示例 here 工作正常。

【问题讨论】:

  • 试图访问索引超出数组边界的数组元素。

标签: mahout


【解决方案1】:

我认为这可能是您如何放置训练文件的问题。 文件应按以下方式组织:

MyData-全部

\classA

 -file1
 -file2
 -...

\classB

 -filex

....

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多