public class UnivariateKernelEstimator extends java.lang.Object implements UnivariateDensityEstimator, UnivariateIntervalEstimator, UnivariateQuantileEstimator, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static double |
CONST
Constant for Gaussian density.
|
protected double |
m_Exponent
The exponent to use in computation of bandwidth (default: -0.25)
|
protected double |
m_MinWidth
The minimum allowed value of the kernel width (default: 1.0E-6)
|
protected int |
m_NumIntervals
The number of intervals used to approximate prediction interval.
|
protected double |
m_SumOfWeights
The weight of the values collected so far
|
protected double |
m_Threshold
Threshold at which further kernels are no longer added to sum.
|
protected java.util.TreeMap<java.lang.Double,java.lang.Double> |
m_TM
The collection used to store the weighted values.
|
protected double |
m_WeightedSum
The weighted sum of values
|
protected double |
m_WeightedSumSquared
The weighted sum of squared values
|
protected double |
m_Width
The current bandwidth (only computed when needed)
|
| Constructor and Description |
|---|
UnivariateKernelEstimator() |
| Modifier and Type | Method and Description |
|---|---|
void |
addValue(double value,
double weight)
Adds a value to the density estimator.
|
java.lang.String |
getRevision()
Returns the revision string.
|
java.lang.String |
globalInfo()
Returns a string describing the estimator.
|
double |
logDensity(double value)
Returns the natural logarithm of the density estimate at the given point.
|
protected double |
logOfSum(double logOfX,
double logOfY)
Computes the logarithm of x and y given the logarithms of x and y.
|
static void |
main(java.lang.String[] args)
Main method, used for testing this class.
|
double[][] |
predictIntervals(double conf)
Returns the interval for the given confidence value.
|
double |
predictQuantile(double percentage)
Returns the quantile for the given percentage.
|
protected void |
runningSum(java.util.Set<java.util.Map.Entry<java.lang.Double,java.lang.Double>> c,
double value,
double[] sums)
Compute running sum of density values and weights.
|
java.lang.String |
toString()
Returns textual description of this estimator.
|
void |
updateWidth()
Updates bandwidth: the sample standard deviation is multiplied by the total
weight to the power of the given exponent.
|
protected java.util.TreeMap<java.lang.Double,java.lang.Double> m_TM
protected double m_WeightedSum
protected double m_WeightedSumSquared
protected double m_SumOfWeights
protected double m_Width
protected double m_Exponent
protected double m_MinWidth
public static final double CONST
protected double m_Threshold
protected int m_NumIntervals
public java.lang.String globalInfo()
public void addValue(double value,
double weight)
addValue in interface UnivariateDensityEstimatoraddValue in interface UnivariateIntervalEstimatoraddValue in interface UnivariateQuantileEstimatorvalue - the value to addweight - the weight of the valuepublic void updateWidth()
public double[][] predictIntervals(double conf)
predictIntervals in interface UnivariateIntervalEstimatorconf - the confidence value in the interval [0, 1]public double predictQuantile(double percentage)
predictQuantile in interface UnivariateQuantileEstimatorpercentage - the percentageprotected double logOfSum(double logOfX,
double logOfY)
protected void runningSum(java.util.Set<java.util.Map.Entry<java.lang.Double,java.lang.Double>> c,
double value,
double[] sums)
public double logDensity(double value)
logDensity in interface UnivariateDensityEstimatorvalue - the value at which to evaluatepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getRevision()
getRevision in interface RevisionHandlerpublic static void main(java.lang.String[] args)