public final double splitCritValue(Distribution train,Distribution test){
  double result=0;
  int numClasses=0;
  int i, j;
  for (j=0; j < test.numClasses(); j++)   if (Utils.gr(train.perClass(j),0) || Utils.gr(test.perClass(j),0))   numClasses++;
  for (i=0; i < test.numBags(); i++)   if (Utils.gr(test.perBag(i),0)) {
    for (j=0; j < test.numClasses(); j++)     if (Utils.gr(test.perClassPerBag(i,j),0))     result-=test.perClassPerBag(i,j) * Math.log(train.perClassPerBag(i,j) + 1);
    result+=test.perBag(i) * Math.log(train.perBag(i) + numClasses);
  }
  return result / ContingencyTables.log2;
}

public final double splitCritValue ( Distribution train , Distribution test ) { double result = 0 ; int numClasses = 0 ; int i , j ; for ( j = 0 ; j < test . numClasses ( ) ; j ++ ) if ( Utils . gr ( train . perClass ( j ) , 0 ) || Utils . gr ( test . perClass ( j ) , 0 ) ) numClasses ++ ; for ( i = 0 ; i < test . numBags ( ) ; i ++ ) if ( Utils . gr ( test . perBag ( i ) , 0 ) ) { for ( j = 0 ; j < test . numClasses ( ) ; j ++ ) if ( Utils . gr ( test . perClassPerBag ( i , j ) , 0 ) ) result -= test . perClassPerBag ( i , j ) * Math . log ( train . perClassPerBag ( i , j ) + 1 ) ; result += test . perBag ( i ) * Math . log ( train . perBag ( i ) + numClasses ) ; } return result / ContingencyTables . log2 ; }
computes entropy of test distribution with respect to training distribution .
