[英]Mahout Naive Bayes Model Unable to find cached files issue
I have imported: 我已经导入:
import org.apache.mahout.classifier.naivebayes.training.TrainNaiveBayesJob;
from the Mahout-Core-0.9-job 来自Mahout-Core-0.9-job
However when I try to call the following method: 但是,当我尝试调用以下方法时:
String[] trainerArgs = {"-i", vectorsDirectory + "tfidf-vectors/",
"-o", modelDirectory,
"-l", labelIndex,
"-el", "-ow"};
TrainNaiveBayesJob thisTrainer = new TrainNaiveBayesJob();
thisTrainer.run(trainerArgs);
I get the following error: 我收到以下错误:
java.lang.Exception: java.lang.IllegalStateException: Unable to find cached files!
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:354)
Caused by: java.lang.IllegalStateException: Unable to find cached files!
at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
at org.apache.mahout.common.HadoopUtil.getCachedFiles(HadoopUtil.java:300)
at org.apache.mahout.common.HadoopUtil.getSingleCachedFile(HadoopUtil.java:281)
at org.apache.mahout.classifier.naivebayes.BayesUtils.readIndexFromCache(BayesUtils.java:146)
at org.apache.mahout.classifier.naivebayes.training.IndexInstancesMapper.setup(IndexInstancesMapper.java:41)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:142)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:364)
at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:223)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Where exactly am I missing the point? 我到底在哪里错了呢? Can somebody guide me?
有人可以指导我吗?
Simply changing the call to the NaiveBayes to: 只需将对NaiveBayes的调用更改为:
ToolRunner.run(new Configuration(), new TrainNaiveBayesJob(), trainerArgs);
solved the issue. 解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.