double leftVal = Math.exp(logDensity(min)); for (int i = 0; i < m_NumIntervals; i++) { double rightVal = Math.exp(logDensity(min + (i + 1) * delta)); probabilities[i] = 0.5 * (leftVal + rightVal) * delta; leftVal = rightVal;
double leftVal = Math.exp(logDensity(min)); for (int i = 0; i < m_NumIntervals; i++) { double rightVal = Math.exp(logDensity(min + (i + 1) * delta)); probabilities[i] = 0.5 * (leftVal + rightVal) * delta; leftVal = rightVal;
/** * Returns the natural logarithm of the density estimate at the given * point. * * @param value the value at which to evaluate * @return the natural logarithm of the density estimate at the given * value */ public double logDensity(double value) { updateModel(); if (m_MixtureModel == null) { return Math.log(Double.MIN_VALUE); } return m_MixtureModel.logDensity(value); }
if (!inBag[j]) { double weight = m_Weights[j]; locLogLikelihood += weight * mixtureModel.logDensity(m_Values[j]); totalWeight += weight;
if (!inBag[j]) { double weight = m_Weights[j]; locLogLikelihood += weight * mixtureModel.logDensity(m_Values[j]); totalWeight += weight;
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;
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;
/** * Returns the natural logarithm of the density estimate at the given * point. * * @param value the value at which to evaluate * @return the natural logarithm of the density estimate at the given * value */ public double logDensity(double value) { updateModel(); if (m_MixtureModel == null) { return Math.log(Double.MIN_VALUE); } return m_MixtureModel.logDensity(value); }
/** * Computes loglikelihood of current model. */ public double loglikelihood(double[] values, double[] weights) { double sum = 0; double sumOfWeights = 0; for (int i = 0; i < values.length; i++) { sum += weights[i] * logDensity(values[i]); sumOfWeights += weights[i]; } return sum / sumOfWeights; }
/** * Computes loglikelihood of current model. */ public double loglikelihood(double[] values, double[] weights) { double sum = 0; double sumOfWeights = 0; for (int i = 0; i < values.length; i++) { sum += weights[i] * logDensity(values[i]); sumOfWeights += weights[i]; } return sum / sumOfWeights; }