private void rescalePriors(ExampleSet exampleSet,double[] classPriors){
  double[] weights=new double[2];
  for (int i=0; i < weights.length; i++) {
    weights[i]=1.0d / (weights.length * classPriors[i]);
  }
  Iterator<Example> exRead=exampleSet.iterator();
  while (exRead.hasNext()) {
    Example example=exRead.next();
    example.setWeight(weights[(int)example.getLabel()]);
  }
}

private void rescalePriors ( ExampleSet exampleSet , double [ ] classPriors ) { double [ ] weights = new double [ 2 ] ; for ( int i = 0 ; i < weights . length ; i ++ ) { weights [ i ] = 1.0d / ( weights . length * classPriors [ i ] ) ; } Iterator < Example > exRead = exampleSet . iterator ( ) ; while ( exRead . hasNext ( ) ) { Example example = exRead . next ( ) ; example . setWeight ( weights [ ( int ) example . getLabel ( ) ] ) ; } }
computes the weighted class priors of the boolean target attribute and shifts weights so that the priors are equal afterwards .
