int[][] featureValueCountsByClass = new int[getInputFormat().classAttribute().numValues()][attr.numValues()];
instanceEnum = getInputFormat().enumerateInstances();
while(instanceEnum.hasMoreElements()) {
Instance instance = (Instance) instanceEnum.nextElement();
int value = (int) instance.value(attr);
int classValue = (int) instance.classValue();
featureValueCounts[value]++;
featureValueCountsByClass[classValue][value]++;
}
for (int valueIndex1 = 0; valueIndex1 < attr.numValues(); valueIndex1++) {
for (int valueIndex2 = 0; valueIndex2 < attr.numValues(); valueIndex2++) {