@CodeReview(reviewer="Kevin R. Dixon", date="2009-07-06", changesNeeded=false, comments={"Made the learning methods take <? extends Number>","Now extends AbstractUnivariateScalarFunction","Cleaned up javadoc"}) public class StandardDistributionNormalizer extends AbstractUnivariateScalarFunction
StandardDistributionNormalizer
class implements a normalization
method where a real value is converted onto a standard distribution. This
means that the value is subtracted by the mean and divided by the standard
deviation.
Modifier and Type | Class and Description |
---|---|
static class |
StandardDistributionNormalizer.Learner
The
Learner class implements a BatchLearner object for
a StandardDistributionNormalizer . |
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_MEAN
The default mean is 0.0.
|
static double |
DEFAULT_VARIANCE
The default variance is 1.0.
|
protected double |
mean
The mean of normalization.
|
protected double |
standardDeviation
The cached value of the standard deviation for normalization.
|
protected double |
variance
The variance for normalization.
|
Constructor and Description |
---|
StandardDistributionNormalizer()
Creates a new instance of StandardNormalization with a mean of 0.0 and
a variance of 1.0.
|
StandardDistributionNormalizer(double mean,
double variance)
Creates a new instance of StandardDistributionNormalizer with the given
mean and variance.
|
StandardDistributionNormalizer(StandardDistributionNormalizer other)
Creates a new copy of a StandardDistributionNormalizer.
|
StandardDistributionNormalizer(UnivariateGaussian gaussian)
Creates a new instance of StandardDistributionNormalizer from the given
Gaussian.
|
Modifier and Type | Method and Description |
---|---|
StandardDistributionNormalizer |
clone()
Creates a new copy of this StandardDistributionNormalizer.
|
double |
evaluate(double value)
Normalizes the given double value by subtracting the mean and dividing
by the standard deviation (the square root of the variance).
|
double |
getMean()
Gets the mean.
|
double |
getVariance()
Gets the variance.
|
static StandardDistributionNormalizer |
learn(java.util.Collection<? extends java.lang.Number> values)
Builds a StandardDistributionNormalizer by computing the mean and
variance of the given collection of values.
|
static StandardDistributionNormalizer |
learn(java.util.Collection<? extends java.lang.Number> values,
double outlierPercent)
Builds a StandardDistributionNormalizer by computing the mean and
variance of the given collection of values.
|
void |
setMean(double mean)
Sets the mean.
|
void |
setVariance(double variance)
Sets the variance.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
evaluate, evaluateAsDouble
public static final double DEFAULT_MEAN
public static final double DEFAULT_VARIANCE
protected double mean
protected double variance
protected double standardDeviation
public StandardDistributionNormalizer()
public StandardDistributionNormalizer(double mean, double variance)
mean
- The mean.variance
- The variance.public StandardDistributionNormalizer(UnivariateGaussian gaussian)
gaussian
- The Gaussian to initialize the normalizer with.public StandardDistributionNormalizer(StandardDistributionNormalizer other)
other
- The StandardDistributionNormalizer to copy.public StandardDistributionNormalizer clone()
clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public double evaluate(double value)
value
- The value to normalize.public double getMean()
public void setMean(double mean)
mean
- The mean.public double getVariance()
public void setVariance(double variance)
variance
- The variance.public static StandardDistributionNormalizer learn(java.util.Collection<? extends java.lang.Number> values)
values
- The values to use to build the normalizer.public static StandardDistributionNormalizer learn(java.util.Collection<? extends java.lang.Number> values, double outlierPercent)
values
- The values to use to build the normalizer.outlierPercent
- The percentage of outliers to exclude.