@Override public double predictQuantile(double percentage){
  updateBoundariesAndOrWeights();
  double val=Statistics.normalInverse(1.0 - (1.0 - 0.95) / 2);
  double min=m_TM.firstKey() - val * m_Width;
  double max=m_TM.lastKey() + val * m_Width;
  double delta=(max - min) / m_NumIntervals;
  double sum=0;
  double leftVal=Math.exp(logDensity(min));
  for (int i=0; i < m_NumIntervals; i++) {
    if (sum >= percentage) {
      return min + i * delta;
    }
    double rightVal=Math.exp(logDensity(min + (i + 1) * delta));
    sum+=0.5 * (leftVal + rightVal) * delta;
    leftVal=rightVal;
  }
  return max;
}

@ Override public double predictQuantile ( double percentage ) { updateBoundariesAndOrWeights ( ) ; double val = Statistics . normalInverse ( 1.0 - ( 1.0 - 0.95 ) / 2 ) ; double min = m_TM . firstKey ( ) - val * m_Width ; double max = m_TM . lastKey ( ) + val * m_Width ; double delta = ( max - min ) / m_NumIntervals ; double sum = 0 ; double leftVal = Math . exp ( logDensity ( min ) ) ; for ( int i = 0 ; i < m_NumIntervals ; i ++ ) { if ( sum >= percentage ) { return min + i * delta ; } double rightVal = Math . exp ( logDensity ( min + ( i + 1 ) * delta ) ) ; sum += 0.5 * ( leftVal + rightVal ) * delta ; leftVal = rightVal ; } return max ; }
returns the quantile for the given percentage .
