public class NumericAttributeBinData extends java.lang.Object implements weka.core.Aggregateable<NumericAttributeBinData>
Modifier and Type | Field and Description |
---|---|
static int |
MAX_BINS
Maximum bins to create
|
Constructor and Description |
---|
NumericAttributeBinData(java.lang.String attName,
weka.core.Attribute summaryAtt,
int maxBins)
Constructor
|
NumericAttributeBinData(java.lang.String attName,
double numPoints,
double min,
double max,
double stdDev,
double missingFreq,
double lowerPercentile,
double upperPercentile,
int maxBins)
Constructor
|
NumericAttributeBinData(java.lang.String attName,
double numPoints,
double min,
double max,
double stdDev,
double missingFreq,
int maxBins)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(double value,
double weight)
Add a value to the histogram.
|
NumericAttributeBinData |
aggregate(NumericAttributeBinData b) |
void |
finalizeAggregation() |
java.lang.String |
getAttributeName()
Get the name of the attribute that this histogram is for
|
java.util.List<java.lang.Double> |
getBinFreqs()
Get a list of bin frequencies for this histogram
|
java.util.List<java.lang.String> |
getBinLabels()
Get a list of bin labels for this histogram
|
double |
getBinWidth()
Get the bin width for this attribute
|
double |
getMissingFreq()
Get the number of missing values
|
int |
getNumBins()
Get the number of bins for this attribute
|
static void |
main(java.lang.String[] args) |
static int |
numBinsHeuristic(double stdDev,
double numPoints,
double min,
double max,
int maxBins)
Compute the number of bins for a histogram given summary stats
|
java.lang.String |
toString() |
public static final int MAX_BINS
public NumericAttributeBinData(java.lang.String attName, weka.core.Attribute summaryAtt, int maxBins)
attName
- the name of the attributesummaryAtt
- the summary attribute containing the bin cutpoints and
frequenciesmaxBins
- the maximum number of bins to allow (if setting bin
cutpoints based on range and overall count) or -1 to use the
default max.public NumericAttributeBinData(java.lang.String attName, double numPoints, double min, double max, double stdDev, double missingFreq, int maxBins)
attName
- the name of the attributenumPoints
- the number of points that have been seen for this
attributemin
- the minimum valuemax
- the maximum valuestdDev
- the standard deviationmissingFreq
- the number of missing valuesmaxBins
- the maximum number of bins to allow (if setting bin
cutpoints based on range and overall count) or -1 to use the
default max.public NumericAttributeBinData(java.lang.String attName, double numPoints, double min, double max, double stdDev, double missingFreq, double lowerPercentile, double upperPercentile, int maxBins)
attName
- the name of the attributenumPoints
- the number of points that have been seen for this
attributemin
- the minimum valuemax
- the maximum valuestdDev
- the standard deviationmissingFreq
- the number of missing valueslowerPercentile
- the lower percentile to use for the equal width
binningupperPercentile
- the upper percentile to use for hte equal width
binningmaxBins
- the maximum number of bins to usepublic int getNumBins()
public double getBinWidth()
public java.util.List<java.lang.String> getBinLabels()
public java.util.List<java.lang.Double> getBinFreqs()
public double getMissingFreq()
public java.lang.String getAttributeName()
public void addValue(double value, double weight)
value
- the value to addweight
- the weightpublic java.lang.String toString()
toString
in class java.lang.Object
public NumericAttributeBinData aggregate(NumericAttributeBinData b) throws java.lang.Exception
aggregate
in interface weka.core.Aggregateable<NumericAttributeBinData>
java.lang.Exception
public void finalizeAggregation() throws java.lang.Exception
finalizeAggregation
in interface weka.core.Aggregateable<NumericAttributeBinData>
java.lang.Exception
public static int numBinsHeuristic(double stdDev, double numPoints, double min, double max, int maxBins)
stdDev
- the standard deviation of the variable in questionnumPoints
- the number of observed data pointsmin
- the minimum valuemax
- the maximummaxBins
- the maximum number of bins to allowpublic static void main(java.lang.String[] args)