warn driver.mahoutdriver:无法添加类:org.apache.mahout.classifier.bayes.preparetwentynewsgroups

ffvjumwh  于 2021-06-04  发布在  Hadoop
关注(0)|答案(3)|浏览(371)

我是hadoop和mahout的新手。首先,我运行了mahout提供的bayes分类器的简单示例。我想获取bayes train输入数据集,因此运行了以下命令:

mahout org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups

-p /Examples/20news-bydate-train

-o /Examples/bayes-train-input

-a org.apache.mahout.vectorizer.DefaultAnalyzer

-c UTF-8

但结果是

我怎样才能解决这个问题?

cpjpxq1n

cpjpxq1n1#

正如上面所写:

MAHOUT_LOCAL is not set

因此不可能找到 PrepareTwentyNewsGroups 班级。根据您的系统,设置环境变量mahout\u local,例如:

MAHOUT_LOCAL=/usr/local/lib/mahout
  export MAHOUT_LOCAL

(将这些行放入.bash\u概要文件中,或者直接放入shell中,如果可以的话,可以反复尝试)

j0pj023g

j0pj023g2#

在mahout版本0.6中,不推荐使用诸如preparetwentynewsgroups、trainclassifier、testclassifier等cli API,您可以从examples/bin目录运行一些shell脚本示例,例如运行examples/bin/classify-20newsgroups.sh。
这个问题的一个可能的解决方案是回归到版本0.6。

a5g8bdjr

a5g8bdjr3#

实际上,根据http://svn.apache.org/repos/asf/mahout/trunk/bin/mahout :
mahout\u local:设置为空字符串以外的任何值,以强制mahout在本地运行,即使设置了hadoop\u conf\u dir和hadoop\u home
如果要在本地运行mahout,只需将mahout设置为local。如果您想在hadoop集群上运行它,只需设置hadoop\u home和hadoop\u conf\u dir。

相关问题