Exemple #1
0
 /**
  * Given cumulative probabilities select a nominal attribute value index
  *
  * @param cdf array of cumulative probabilities
  * @return index of attribute selected based on the probability distribution
  */
 protected int selectIndexProbabilistically(double[] cdf) {
   double rnd = m_Random.nextDouble();
   int index = 0;
   while (index < cdf.length && rnd > cdf[index]) {
     index++;
   }
   return index;
 }