List of usage examples for org.apache.mahout.classifier.naivebayes BayesUtils readScoresFromCache
public static Map<String, Vector> readScoresFromCache(Configuration conf) throws IOException
From source file:com.netease.news.classifier.naivebayes.ThetaMapper.java
License:Apache License
@Override protected void setup(Context ctx) throws IOException, InterruptedException { super.setup(ctx); Configuration conf = ctx.getConfiguration(); float alphaI = conf.getFloat(ALPHA_I, 1.0f); Map<String, Vector> scores = BayesUtils.readScoresFromCache(conf); if (conf.getBoolean(TRAIN_COMPLEMENTARY, false)) { trainer = new ComplementaryThetaTrainer(scores.get(TrainNaiveBayesJob.WEIGHTS_PER_FEATURE), scores.get(TrainNaiveBayesJob.WEIGHTS_PER_LABEL), alphaI); } else {// w w w . jav a2s. c o m trainer = new StandardThetaTrainer(scores.get(TrainNaiveBayesJob.WEIGHTS_PER_FEATURE), scores.get(TrainNaiveBayesJob.WEIGHTS_PER_LABEL), alphaI); } }