|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--shared.RealAndLabelColumn
The RealAttributeColumn class provides a array representation for a real column (real attribute, label and weight). The array representation has better data locality than a doubly linked instance list and thus is more efficient for discretization. RealAttributeColumn includes the AttrInfo for the real attribute and the label. However, these are const references, therefore whoever owns these AttrInfos must not delete them until the RealAttribueColumn referring to them has been deleted.
The size of the data array must not exceed that given in the constructor. Because the class is used for transforming already existing instance lists (see InstanceList.transpose), the maximum size can be estimated well enough in advance.
Zero-weight instances added to the column are disregarded. Since an instance with zero weight is equivalent to no instances, such instances should be disregarded by tasks that use the RealAndLabelColumn (like discretization and the like).
Constructor Summary | |
RealAndLabelColumn(int length,
int labelCount,
RealAttrInfo rai,
NominalAttrInfo nai)
RealAndLabelColumn constructor for labelled columns. |
|
RealAndLabelColumn(int length,
RealAttrInfo rai)
RealAndLabelColumn constructor for unlabelled columns |
Method Summary | |
void |
add_known(float value,
double weight)
Adds a known real value and weight. |
void |
add_known(float value,
int label,
double weight)
Adds a known real value, label and weight. |
void |
add_unknown(double weight)
Adds a "unknown" value and weight. |
void |
add_unknown(int label,
double weight)
Adds a "unknown" value, label and weight. |
RealAttrInfo |
attr_info()
Returns the information on the real attribute stored in this column. |
AttrLabelPair |
index(int index)
Returns the real/label pair at the specified index number. |
int |
init_dist_counts(double[][] splitAndLabelDist,
double[] labelDist)
Fills the fields of the splitAndLabelDist array, returns the number of used labels for known instances. |
int |
known_count()
Returns the count of known real values. |
double |
known_weight()
Returns the weight of the known values. |
int |
label_count()
Return the number of possible labels. |
void |
sort()
Sorts the real/label pairs. |
double |
total_weight()
Returns the total weight of all values. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public RealAndLabelColumn(int length, int labelCount, RealAttrInfo rai, NominalAttrInfo nai)
length
- The number of real/label pairs to be stored.labelCount
- Number of possible labels.rai
- Attribute information for the real attribute stored.nai
- Attribute information for the label attribute.public RealAndLabelColumn(int length, RealAttrInfo rai)
length
- The number of real values to be stored.rai
- Attribute information for the real attribute stored.Method Detail |
public RealAttrInfo attr_info()
public void add_unknown(int label, double weight)
label
- The label value associated with the unknown value.weight
- The weight of this real/label pair.public void add_unknown(double weight)
weight
- The weight of this real value.public void add_known(float value, int label, double weight)
value
- Real value to be stored.label
- Label associated with this real value.weight
- The weight of this real/label pair.public void add_known(float value, double weight)
value
- Real value to be stored.weight
- The weight of this real value.public double known_weight()
public AttrLabelPair index(int index)
index
- The index to be returned.public int known_count()
public double total_weight()
public int init_dist_counts(double[][] splitAndLabelDist, double[] labelDist)
splitAndLabelDist
- The split and label distribution to be filled.labelDist
- The label to be filled.public int label_count()
public void sort()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |