public class RealInfo extends SkeletalVariableInfo
Contains sufficient statistics to model the feature as a gaussian, plus the max and min values.
Does not contain an id number, but can be transformed into RealIDInfo
which
does contain an id number.
Modifier and Type | Field and Description |
---|---|
protected double |
max
The maximum observed feature value.
|
protected double |
mean
The feature mean.
|
protected double |
min
The minimum observed feature value.
|
protected double |
sumSquares
The sum of the squared feature values (used to compute the variance).
|
count, name
Modifier | Constructor and Description |
---|---|
|
RealInfo(RealInfo other)
Copy constructor.
|
protected |
RealInfo(RealInfo other,
String newName)
Copy constructor which renames the feature.
|
|
RealInfo(String name)
Creates an empty real info with the supplied name.
|
|
RealInfo(String name,
int count)
Creates a real info with the supplied starting conditions.
|
|
RealInfo(String name,
int count,
double max,
double min,
double mean,
double sumSquares)
Creates a real info with the supplied starting conditions.
|
Modifier and Type | Method and Description |
---|---|
RealInfo |
copy()
Returns a copy of this variable info.
|
double |
getMax()
Gets the maximum observed value.
|
double |
getMean()
Gets the sample mean.
|
double |
getMin()
Gets the minimum observed value.
|
double |
getVariance()
Gets the sample variance.
|
RealIDInfo |
makeIDInfo(int id)
Generates a VariableIDInfo subclass which represents the same feature.
|
protected void |
observe(double value)
Records the value.
|
RealInfo |
rename(String newName)
Rename generates a fresh VariableInfo with the new name.
|
String |
toString() |
double |
uniformSample(SplittableRandom rng)
Sample a value uniformly from the range of this variable.
|
equals, getCount, getName, hashCode
protected double max
protected double min
protected double mean
protected double sumSquares
public RealInfo(String name)
name
- The feature name.public RealInfo(String name, int count)
All observations are assumed to be of zero.
name
- The feature name.count
- The number of zeros observed.public RealInfo(String name, int count, double max, double min, double mean, double sumSquares)
name
- The feature name.count
- The observation count.max
- The maximum observed value.min
- The minimum observed value.mean
- The mean observed value.sumSquares
- The sum of the squared values (used to calculate variance online).public RealInfo(RealInfo other)
other
- The info to copy.protected void observe(double value)
SkeletalVariableInfo
observe
in class SkeletalVariableInfo
value
- The observed value.public double getMin()
public double getMax()
public double getMean()
public double getVariance()
public RealInfo copy()
VariableInfo
public RealIDInfo makeIDInfo(int id)
VariableInfo
id
- The id number.public RealInfo rename(String newName)
VariableInfo
newName
- The new name.public double uniformSample(SplittableRandom rng)
VariableInfo
rng
- The rng to use.public String toString()
toString
in class SkeletalVariableInfo
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.