public class UnivariateEqualFrequencyHistogramEstimator 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_Boundaries
The interval boundaries.
|
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_NumBins
The number of bins to use.
|
protected int |
m_NumIntervals
The number of intervals used to approximate prediction interval.
|
protected double |
m_SumOfWeights
The total sum of weights.
|
protected java.util.TreeMap<java.lang.Double,java.lang.Double> |
m_TM
The collection used to store the weighted values.
|
protected boolean |
m_UpdateWeightsOnly
Whether boundaries are updated or only weights.
|
protected double |
m_WeightedSum
The weighted sum of values
|
protected double |
m_WeightedSumSquared
The weighted sum of squared values
|
protected double[] |
m_Weights
The weight of each interval.
|
protected double |
m_Width
The current bandwidth (only computed when needed)
|
| Constructor and Description |
|---|
UnivariateEqualFrequencyHistogramEstimator() |
| Modifier and Type | Method and Description |
|---|---|
void |
addValue(double value,
double weight)
Adds a value to the density estimator.
|
int |
getNumBins()
Gets the number of bins
|
java.lang.String |
getRevision()
Returns the revision string.
|
boolean |
getUpdateWeightsOnly()
Gets whether only weights should be udpated
|
java.lang.String |
globalInfo()
Returns a string describing the estimator.
|
void |
initializeStatistics()
Triggers construction of estimator based on current data and then
initializes the statistics.
|
double |
logDensity(double value)
Returns the natural logarithm of the density estimate at the given point.
|
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.
|
void |
setNumBins(int numBins)
Sets the number of bins
|
void |
setUpdateWeightsOnly(boolean flag)
Sets whether only weights should be udpated.
|
java.lang.String |
toString()
Returns textual description of this estimator.
|
protected void |
updateBoundariesAndOrWeights()
Updates the boundaries if necessary.
|
protected void |
updateBoundariesAndWeights()
Updates the boundaries and weights.
|
protected void |
updateWeightsOnly()
Updates the weights only.
|
protected java.util.TreeMap<java.lang.Double,java.lang.Double> m_TM
protected double[] m_Boundaries
protected double[] m_Weights
protected double m_WeightedSum
protected double m_WeightedSumSquared
protected double m_SumOfWeights
protected int m_NumBins
protected double m_Width
protected double m_Exponent
protected double m_MinWidth
public static final double CONST
protected int m_NumIntervals
protected boolean m_UpdateWeightsOnly
public UnivariateEqualFrequencyHistogramEstimator()
public java.lang.String globalInfo()
public int getNumBins()
public void setNumBins(int numBins)
numBins - the number of binspublic void initializeStatistics()
public void setUpdateWeightsOnly(boolean flag)
public boolean getUpdateWeightsOnly()
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 valueprotected void updateBoundariesAndOrWeights()
protected void updateWeightsOnly()
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionprotected void updateBoundariesAndWeights()
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 percentagepublic double logDensity(double value)
logDensity in interface UnivariateDensityEstimatorvalue - the value at which to evaluatepublic java.lang.String getRevision()
getRevision in interface RevisionHandlerpublic java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)