private boolean FayyadAndIranisMDL(double[] priorCounts,double[][] bestCounts,double numInstances,int numCutPoints){
  double priorEntropy, entropy, gain;
  double entropyLeft, entropyRight, delta;
  int numClassesTotal, numClassesRight, numClassesLeft;
  priorEntropy=ContingencyTables.entropy(priorCounts);
  entropy=ContingencyTables.entropyConditionedOnRows(bestCounts);
  gain=priorEntropy - entropy;
  numClassesTotal=0;
  for (  double priorCount : priorCounts) {
    if (priorCount > 0) {
      numClassesTotal++;
    }
  }
  numClassesLeft=0;
  for (int i=0; i < bestCounts[0].length; i++) {
    if (bestCounts[0][i] > 0) {
      numClassesLeft++;
    }
  }
  numClassesRight=0;
  for (int i=0; i < bestCounts[1].length; i++) {
    if (bestCounts[1][i] > 0) {
      numClassesRight++;
    }
  }
  entropyLeft=ContingencyTables.entropy(bestCounts[0]);
  entropyRight=ContingencyTables.entropy(bestCounts[1]);
  delta=Utils.log2(Math.pow(3,numClassesTotal) - 2) - ((numClassesTotal * priorEntropy) - (numClassesRight * entropyRight) - (numClassesLeft * entropyLeft));
  return (gain > (Utils.log2(numCutPoints) + delta) / numInstances);
}

private boolean FayyadAndIranisMDL ( double [ ] priorCounts , double [ ] [ ] bestCounts , double numInstances , int numCutPoints ) { double priorEntropy , entropy , gain ; double entropyLeft , entropyRight , delta ; int numClassesTotal , numClassesRight , numClassesLeft ; priorEntropy = ContingencyTables . entropy ( priorCounts ) ; entropy = ContingencyTables . entropyConditionedOnRows ( bestCounts ) ; gain = priorEntropy - entropy ; numClassesTotal = 0 ; for ( double priorCount : priorCounts ) { if ( priorCount > 0 ) { numClassesTotal ++ ; } } numClassesLeft = 0 ; for ( int i = 0 ; i < bestCounts [ 0 ] . length ; i ++ ) { if ( bestCounts [ 0 ] [ i ] > 0 ) { numClassesLeft ++ ; } } numClassesRight = 0 ; for ( int i = 0 ; i < bestCounts [ 1 ] . length ; i ++ ) { if ( bestCounts [ 1 ] [ i ] > 0 ) { numClassesRight ++ ; } } entropyLeft = ContingencyTables . entropy ( bestCounts [ 0 ] ) ; entropyRight = ContingencyTables . entropy ( bestCounts [ 1 ] ) ; delta = Utils . log2 ( Math . pow ( 3 , numClassesTotal ) - 2 ) - ( ( numClassesTotal * priorEntropy ) - ( numClassesRight * entropyRight ) - ( numClassesLeft * entropyLeft ) ) ; return ( gain > ( Utils . log2 ( numCutPoints ) + delta ) / numInstances ) ; }
test using fayyad and irani ' s mdl criterion .
