@Override
public boolean apply(String label, double sigmaJ) {
double weight = Math.log((value.get() + alphaI) / (sigmaJSigmaK - sigmaJ + vocabCount));
reporter.setStatus("Complementary Bayes Theta Normalizer Mapper: " + label + " => " + weight);
StringTuple normalizerTuple = new StringTuple(BayesConstants.LABEL_THETA_NORMALIZER);
normalizerTuple.add(label);
try {
output.collect(normalizerTuple, new DoubleWritable(weight));
} catch (IOException e) {
throw new IllegalStateException(e);
} // output Sigma_j
return true;
}
});
} else {
String label = key.stringAt(1);
double dIJ = value.get();
double denominator = 0.5 * (sigmaJSigmaK / vocabCount + dIJ * this.labelWeightSum.size());
double weight = Math.log(1.0 - dIJ / denominator);
reporter.setStatus("Complementary Bayes Theta Normalizer Mapper: " + label + " => " + weight);
StringTuple normalizerTuple = new StringTuple(BayesConstants.LABEL_THETA_NORMALIZER);
normalizerTuple.add(label);
// output -D_ij
output.collect(normalizerTuple, new DoubleWritable(weight));
}