@PublicationReference(author="Wikipedia", title="Algorithms for calculating variance", year=2011, type=WebPage, url="http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance") public static class UnivariateGaussian.SufficientStatistic extends AbstractSufficientStatistic<java.lang.Double,UnivariateGaussian>
Modifier and Type | Field and Description |
---|---|
protected double |
mean
The mean of the Gaussian.
|
protected double |
sumSquaredDifferences
This is the sum-squared differences
|
count
Constructor and Description |
---|
SufficientStatistic()
Creates a new, empty
SufficientStatistic . |
SufficientStatistic(double defaultVariance)
Creates a new
SufficientStatistic with the given value
to initialize the variance. |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Resets this set of sufficient statistics to its empty state.
|
UnivariateGaussian.SufficientStatistic |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
UnivariateGaussian.PDF |
create()
Creates a new instance of an object.
|
void |
create(UnivariateGaussian distribution)
Modifies the given distribution with the parameters indicated by the
sufficient statistics
|
double |
getMean()
Gets the mean of the Gaussian.
|
double |
getSampleVariance()
Gets the sample variance, which may be a biased estimate.
|
double |
getSumSquaredDifferences()
Gets the sum of squared differences from the mean.
|
double |
getVariance()
Gets the variance of the Gaussian.
|
UnivariateGaussian.SufficientStatistic |
plus(UnivariateGaussian.SufficientStatistic other)
Adds this set of sufficient statistics to another and returns the
combined sufficient statistics.
|
void |
plusEquals(UnivariateGaussian.SufficientStatistic other)
Adds another sufficient statistic to this one.
|
void |
remove(double value)
Removes a value to the sufficient statistics for the Gaussian.
|
void |
update(double value)
Adds a value to the sufficient statistics for the Gaussian.
|
void |
update(java.lang.Double value)
Updates the sufficient statistics from the given value
|
getCount, setCount, update
protected double mean
protected double sumSquaredDifferences
public SufficientStatistic()
SufficientStatistic
.public SufficientStatistic(double defaultVariance)
SufficientStatistic
with the given value
to initialize the variance. This is the initial value for the
sum of squared differences. As the number of elements becomes
larger, the impact of the default variance will decrease.defaultVariance
- The default variance to use. Must be greater than or equal
to zero.public UnivariateGaussian.SufficientStatistic clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AbstractSufficientStatistic<java.lang.Double,UnivariateGaussian>
public void clear()
public UnivariateGaussian.PDF create()
Factory
public void create(UnivariateGaussian distribution)
SufficientStatistic
distribution
- Distribution to modify by side effectpublic void update(java.lang.Double value)
SufficientStatistic
value
- Value to update the sufficient statisticspublic void update(double value)
value
- The value to add.public void remove(double value)
value
- The value to add.public UnivariateGaussian.SufficientStatistic plus(UnivariateGaussian.SufficientStatistic other)
other
- The other set of sufficient statistics.public void plusEquals(UnivariateGaussian.SufficientStatistic other)
other
- The other set of sufficient statistics.public double getMean()
public double getVariance()
public double getSampleVariance()
public double getSumSquaredDifferences()