|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lmu.ifi.dbs.elki.math.MeanVariance
public final class MeanVariance
Do some simple statistics (mean, average). This class can repeatedly be fed with data using the add() methods, The resulting values for mean and average can be queried at any time using getMean() and getVariance(). Trivial code, but replicated a lot. The class is final so it should come at low cost.
Field Summary | |
---|---|
double |
count
Number of Samples. |
double |
sqrSum
Sum of Squares |
double |
sum
Sum of values |
Constructor Summary | |
---|---|
MeanVariance()
Empty constructor |
|
MeanVariance(double sum,
double sqrSum,
double count)
Constructor from full internal data. |
|
MeanVariance(MeanVariance other)
Constructor from other instance |
Method Summary | |
---|---|
double |
denormalizeValue(double val)
Return the unnormalized value (centered at the mean, distance normalized by standard deviation) |
double |
getCount()
Get the number of points the average is based on. |
double |
getMean()
Return mean |
double |
getStddev()
Return standard deviation |
double |
getVariance()
Return variance |
static MeanVariance[] |
newArray(int dimensionality)
Create and initialize a new array of MeanVariance |
double |
normalizeValue(double val)
Return the normalized value (centered at the mean, distance normalized by standard deviation) |
void |
put(double val)
Add a single value with weight 1.0 |
void |
put(double val,
double weight)
Add data with a given weight |
void |
put(MeanVariance other)
Join the data of another MeanVariance instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public double sum
public double sqrSum
public double count
Constructor Detail |
---|
public MeanVariance()
public MeanVariance(double sum, double sqrSum, double count)
sum
- sumsqrSum
- sum of squared valuescount
- sum of weightspublic MeanVariance(MeanVariance other)
other
- other instance to copy data from.Method Detail |
---|
public void put(double val, double weight)
val
- dataweight
- weightpublic void put(double val)
val
- Valuepublic void put(MeanVariance other)
other
- public double getCount()
public double getMean()
public double getVariance()
public double getStddev()
public double normalizeValue(double val)
val
- original value
public double denormalizeValue(double val)
val
- normalized value
public static MeanVariance[] newArray(int dimensionality)
dimensionality
- Dimensionality
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |