question: public static void mapClasses ( int numClusters , int lev , int [ ] [ ] counts , int [ ] clusterTotals , double [ ] current , double [ ] best , int error ) { if ( lev == numClusters ) { if ( error < best [ numClusters ] ) { best [ numClusters ] = error ; for ( int i = 0 ; i < numClusters ; i ++ ) { best [ i ] = current [ i ] ; } } } else { if ( clusterTotals [ lev ] == 0 ) { current [ lev ] = - 1 ; mapClasses ( numClusters , lev + 1 , counts , clusterTotals , current , best , error ) ; } else { current [ lev ] = - 1 ; mapClasses ( numClusters , lev + 1 , counts , clusterTotals , current , best , error + clusterTotals [ lev ] ) ; for ( int i = 0 ; i < counts [ 0 ] . length ; i ++ ) { if ( counts [ lev ] [ i ] > 0 ) { boolean ok = true ; for ( int j = 0 ; j < lev ; j ++ ) { if ( ( int ) current [ j ] == i ) { ok = false ; break ; } } if ( ok ) { current [ lev ] = i ; mapClasses ( numClusters , lev + 1 , counts , clusterTotals , current , best , ( error + ( clusterTotals [ lev ] - counts [ lev ] [ i ] ) ) ) ; } } } } } }
target:  Finds the minimum error mapping of classes to clusters. Recursively considers all possible class to cluster assignments.