@Reference(authors="B. P. Welford", title="Note on a method for calculating corrected sums of squares and products", booktitle="Technometrics 4(3)") public class Mean extends Object
B. P. Welford
Note on a method for calculating corrected sums of squares and products
in: Technometrics 4(3)
D.H.D. West
Updating Mean and Variance Estimates: An Improved Method
In: Communications of the ACM, Volume 22 Issue 9
Modifier and Type | Field and Description |
---|---|
protected double |
m1
Mean of values - first moment.
|
protected double |
n
Weight sum (number of samples).
|
Constructor and Description |
---|
Mean()
Empty constructor
|
Mean(Mean other)
Constructor from other instance
|
Modifier and Type | Method and Description |
---|---|
double |
getCount()
Get the number of points the average is based on.
|
double |
getMean()
Return mean
|
static Mean[] |
newArray(int dimensionality)
Create and initialize a new array of MeanVariance
|
static double |
of(double[] data)
Static helper function.
|
void |
put(double val)
Add a single value with weight 1.0
|
Mean |
put(double[] vals)
Add values with weight 1.0
|
Mean |
put(double[] vals,
double[] weights)
Add values with weight 1.0
|
void |
put(double val,
double weight)
Add data with a given weight.
|
void |
put(Mean other)
Join the data of another MeanVariance instance.
|
void |
reset()
Reset the value.
|
String |
toString() |
protected double m1
protected double n
public Mean()
public Mean(Mean other)
other
- other instance to copy data from.public void put(double val)
val
- Valuepublic void put(double val, double weight)
val
- dataweight
- weightpublic void put(Mean other)
other
- Data to join withpublic Mean put(double[] vals)
vals
- Valuespublic Mean put(double[] vals, double[] weights)
vals
- Valuespublic double getCount()
public double getMean()
public static Mean[] newArray(int dimensionality)
dimensionality
- Dimensionalitypublic void reset()
public static double of(double[] data)
data
- Data to compute the mean for.Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.