public final class MeanVarianceAccumulator extends Object implements Serializable
Note this class is not thread safe.
Constructor and Description |
---|
MeanVarianceAccumulator()
Constructs an empty mean/variance accumulator.
|
MeanVarianceAccumulator(double[] values)
Constructs a mean/variance accumulator and observes the supplied array.
|
MeanVarianceAccumulator(MeanVarianceAccumulator other)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
long |
getCount()
Gets the observation count.
|
double |
getMax()
Gets the maximum observed value.
|
double |
getMean()
Gets the sample mean.
|
double |
getMin()
Gets the minimum observed value.
|
double |
getStdDev()
Gets the sample standard deviation.
|
double |
getVariance()
Gets the sample variance.
|
int |
hashCode() |
void |
observe(double value)
Observes a value, i.e., updates the sufficient statistics for computing mean, variance, max and min.
|
void |
observe(double[] values)
Observes a value, i.e., updates the sufficient statistics for computing mean, variance, max and min.
|
void |
reset()
Resets this accumulator to the starting state.
|
double[] |
standardize(double[] input)
Standardizes the input using the computed mean and variance in this accumulator.
|
void |
standardizeInPlace(double[] input)
Standardizes the input using the computed mean and variance in this accumulator.
|
String |
toString() |
public MeanVarianceAccumulator()
public MeanVarianceAccumulator(double[] values)
values
- The array to operate on.public MeanVarianceAccumulator(MeanVarianceAccumulator other)
other
- The MeanVarianceAccumulator to copy.public void reset()
public void observe(double value)
value
- The value to observe.public void observe(double[] values)
values
- The values to observe.public double getMin()
public double getMax()
public double getMean()
public double getVariance()
public long getCount()
public double getStdDev()
public double[] standardize(double[] input)
input
- The input to standardize.public void standardizeInPlace(double[] input)
input
- The input to standardize.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.