SparseVector predictions = user.getPredictions();
if (predictions == null) {
return null;
}
Quantizer q = context.quantizer;
// TODO Re-use accumulators
MutualInformationAccumulator accum = new MutualInformationAccumulator(q.getCount());
for (Pair<VectorEntry,VectorEntry> e: Vectors.fastIntersect(ratings, predictions)) {
accum.count(q.index(e.getLeft().getValue()),
q.index(e.getRight().getValue()));
}
if (accum.getCount() > 0) {
double ratingEntropy = accum.getV1Entropy();
double predEntropy = accum.getV2Entropy();