public class NumericStats extends Stats implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static double |
Q_COMPRESSION
Default compression for TDigest quantile estimators
|
Constructor and Description |
---|
NumericStats(java.lang.String attributeName)
Constructs a new NumericStats
|
NumericStats(java.lang.String attributeName,
double quantileCompression)
Construct a new NumericStats
|
Modifier and Type | Method and Description |
---|---|
static NumericStats |
attributeToStats(weka.core.Attribute a)
Convert a summary meta attribute into a NumericStats object (does not
recover the internal TDigest quantile estimator)
|
void |
computeDerived()
Compute the derived statistics
|
void |
computeQuartilesAndHistogram()
Computes derived stats and computes quartiles and histogram data from our
quantile estimator.
|
void |
deSerializeCurrentQuantileEstimator()
Decode the current TDigest quatile estimator
|
java.util.List<java.lang.String> |
getHistogramBinLabels()
Get the histogram labels
|
java.util.List<java.lang.Double> |
getHistogramFrequencies()
Get the histogram bin frequencies
|
TDigest |
getQuantileEstimator()
Get the quantile estimator in use (if any)
|
double[] |
getStats()
Return the array of statistics
|
weka.core.Attribute |
makeAttribute()
Makes a Attribute that encapsulates the meta data
|
void |
serializeCurrentQuantileEstimator()
Serialize the current TDigest quantile estimator
|
void |
setCompression(double compression)
Set the compression level
|
void |
setHistogramData(java.util.List<java.lang.String> labs,
java.util.List<java.lang.Double> freqs)
Set histogram data for this numeric stats
|
void |
setQuantileEstimator(TDigest estimator)
Set the quantile estimator to use
|
void |
setStats(double[] stats)
Sets the array of statistics.
|
void |
update(double value,
double weight,
boolean treatZeroAsMissing,
boolean updateQuantiles)
Update the incremental aggregateable portions of this NumericStats with the
supplied value
|
public static final double Q_COMPRESSION
public NumericStats(java.lang.String attributeName)
attributeName
- the name of the attribute that these statistics are
forpublic NumericStats(java.lang.String attributeName, double quantileCompression)
attributeName
- the name of the attribute that these statistics are
forquantileCompression
- the degree of compression for quantile
estimation (bigger = less compression)public void update(double value, double weight, boolean treatZeroAsMissing, boolean updateQuantiles)
value
- the value to update withweight
- the weight to usetreatZeroAsMissing
- true if zeros count as missingupdateQuantiles
- true if we should update our quantile estimatorpublic double[] getStats()
public void setStats(double[] stats)
stats
- the stats array to usepublic TDigest getQuantileEstimator()
public void setQuantileEstimator(TDigest estimator)
estimator
- the estimator to usepublic void setCompression(double compression)
compression
- compression levelpublic void serializeCurrentQuantileEstimator()
public void deSerializeCurrentQuantileEstimator()
public void setHistogramData(java.util.List<java.lang.String> labs, java.util.List<java.lang.Double> freqs)
labs
- bin labelsfreqs
- bin frequenciespublic java.util.List<java.lang.String> getHistogramBinLabels()
public java.util.List<java.lang.Double> getHistogramFrequencies()
public weka.core.Attribute makeAttribute()
Stats
makeAttribute
in class Stats
public static NumericStats attributeToStats(weka.core.Attribute a) throws java.lang.IllegalArgumentException
a
- the summary meta attribute to convertjava.lang.IllegalArgumentException
- if a problem occurspublic void computeDerived()
public void computeQuartilesAndHistogram()