@Override
protected void setup(Context context) throws IOException, InterruptedException {
super.setup(context);
Configuration conf = context.getConfiguration();
Path modelPath = HadoopUtil.getSingleCachedFile(conf);
NaiveBayesModel model = NaiveBayesModel.materialize(modelPath, conf);
boolean isComplementary = Boolean.parseBoolean(conf.get(TestNaiveBayesDriver.COMPLEMENTARY));
// ensure that if we are testing in complementary mode, the model has been
// trained complementary. a complementarty model will work for standard classification
// a standard model will not work for complementary classification
if (isComplementary) {
Preconditions.checkArgument((model.isComplemtary() == isComplementary),
"Complementary mode in model is different than test mode");
}
if (isComplementary) {
classifier = new ComplementaryNaiveBayesClassifier(model);