2013-01-04 19 views
4

我正在訓練亨利馬烏分類爲我的數據, 以下命令我發出創建象夫模型建立出錯象夫模型

./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正常工作。

+0

嘗試到做使用超出數組邊界的索引訪問數組元素。 –

回答

0

我認爲這可能是你如何把你的訓練文件的問題。 這些文件應組織如下:

邁德特,所有

\ CLASSA

-file1 
-file2 
-... 

\ CLASSB

-filex 

....