public class NominalStats extends Stats implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
NominalStats.Count
Class that encapsulates a count for nominal value
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MISSING_LABEL
A "label" to use when storing the number of missing values
|
Constructor and Description |
---|
NominalStats(java.lang.String attributeName)
Constructs a new NominalStats
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String label,
double value)
Adds to the count for a given label.
|
static NominalStats |
attributeToStats(weka.core.Attribute a)
Convert a summary meta attribute to a NominalStats
|
double |
getCount(java.lang.String label)
Get the count for a given label
|
java.util.Set<java.lang.String> |
getLabels()
Get the set of labels seen by this NominalStats
|
int |
getMode()
Get the index of the mode
|
java.lang.String |
getModeLabel()
Get the most frequent label (not including missing values)
|
double |
getNumMissing()
Get the number of missing values for this attribute
|
weka.core.Attribute |
makeAttribute()
Makes a Attribute that encapsulates the meta data
|
void |
setNumMissing(double missing)
Set the number of missing values for this attribute
|
public static final java.lang.String MISSING_LABEL
public NominalStats(java.lang.String attributeName)
attributeName
- the name of the data attribute that these stats
pertain topublic static NominalStats attributeToStats(weka.core.Attribute a) throws java.lang.IllegalArgumentException
a
- the attribute to convertjava.lang.IllegalArgumentException
- if a problem occurspublic void add(java.lang.String label, double value)
label
- the label to add the count tovalue
- the count to addpublic java.util.Set<java.lang.String> getLabels()
public double getCount(java.lang.String label)
label
- the label to get the count forpublic double getNumMissing()
public int getMode()
public java.lang.String getModeLabel()
public void setNumMissing(double missing)
missing
- the number of missing valuespublic weka.core.Attribute makeAttribute()
Stats
makeAttribute
in class Stats