protected double computeWeight ( Classifier learner , Instances chunk ) { double mse_i = 0 ; double mse_r = 0 ; double f_ci ; double voteSum ; for ( int i = 0 ; i < chunk . numInstances ( ) ; i ++ ) { try { voteSum = 0 ; for ( double element : learner . getVotesForInstance ( chunk . instance ( i ) ) ) { voteSum += element ; } if ( voteSum > 0 ) { f_ci = learner . getVotesForInstance ( chunk . instance ( i ) ) [ ( int ) chunk . instance ( i ) . classValue ( ) ] / voteSum ; mse_i += ( 1 - f_ci ) * ( 1 - f_ci ) ; } else { mse_i += 1 ; } } catch ( Exception e ) { mse_i += 1 ; } } mse_i /= this . chunkSize ; mse_r = this . computeMseR ( ) ; return java . lang . Math . max ( mse_r - mse_i , 0 ) ; }
Computes the weight of a given classifie .