|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--shared.Instance
The class Instance provides instances with or without label and support for describing instances, iterating through values, and looking at the instance label. Most effort was directed at categorization of labelled instances for supervised learning. Has been extended to tree-structured attributes.
| Field Summary | |
AttrValue[] |
values
The values for each Attribute stored in this Instance. |
| Constructor Summary | |
Instance(Instance source)
Copy constructor for the Instance class. |
|
Instance(Schema newSchema)
Constructor for the Instance class. |
|
| Method Summary | |
AttrInfo |
attr_info(int attrNum)
Returns the information about the attribute specified. |
java.lang.String |
attr_name(int attrNum)
Returns the attribute name. |
java.lang.Object |
clone()
Cloning function for the Instance class. |
void |
copy(Instance other)
Copies the supplied Instance object into this Instance object. |
java.lang.String |
display_unlabelled_out(boolean displayWeight,
boolean normalizeReal)
Returns a String representation of the Instance. |
void |
display_unlabelled(boolean displayWeight,
boolean normalizeReal)
Displays the Instance without labels. |
void |
display(boolean displayWeight,
boolean normalizeReals)
Displays the Instance with labels. |
boolean |
equals(Instance i_instance)
Checks if this Instance is equal to the specified Instance. |
AttrValue |
get_label()
Returns the label this Instance is categorized as. |
Schema |
get_schema()
Returns the Schema of attributes for this Instance. |
AttrValue |
get_value(int index)
Returns the attribute value at the specified attribute. |
double |
get_weight()
Returns the weight for this Instance. |
AttrValue |
index(int index)
Returns the AttrValue at the specified index number. |
boolean |
is_labelled()
Checks if this Instance is labelled. |
boolean |
is_labelled(boolean fatalOnFalse)
Checks if this Instance is labelled. |
AttrInfo |
label_info()
Returns the information about the label this Instance is categorized as. |
NominalAttrInfo |
nominal_label_info()
Returns the information on the label attribute. |
int |
num_attr_values(int attrNum)
Returns the number of values for the specified attribute. |
int |
num_attr()
Returns the number of attributes for data in this Instance. |
int |
num_label_values()
Returns the number of possible label values in the Schema of this Instance. |
java.lang.String |
out(boolean displayWeight,
boolean normalizeReals)
Returns a String representation of the Instance. |
Instance |
project(Schema shortSchema,
boolean[] attrMask)
Returns a copy with only the attributes included that are are indicated by the mask. |
Instance |
remove_attr(int attrNum)
Remove an Attribute from an Instance. |
Instance |
remove_attr(int attrNum,
Schema schemaWithDelAttr)
Remove an Attribute from an Instance. |
void |
set_label(AttrValue lvalue)
Sets the label for this Instance. |
void |
set_schema(Schema schemaRC)
Sets the Schema for this Instance. |
void |
set_weight(double wt)
Sets the weight for this Instance. |
java.lang.String |
toString()
Transfers this Instance to a String value. |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public AttrValue[] values
| Constructor Detail |
public Instance(Schema newSchema)
newSchema - The Schema for the data stored in this Instance.public Instance(Instance source)
source - The original Instance to be copied.| Method Detail |
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
public Schema get_schema()
public int num_attr()
public AttrValue get_label()
public Instance project(Schema shortSchema,
boolean[] attrMask)
shortSchema - The Schema for the new Instance created.attrMask - An array of boolean values equal in length to the
original number of attributes. Each element
relates to an attribute of the original
instance. If the element is set TRUE, the
corresponding attribute is included in the new
Instance.public AttrValue get_value(int index)
index - The index number for the specified attribute.public void set_schema(Schema schemaRC)
schemaRC - The new Schema for this Instance.public void set_weight(double wt)
wt - The new weight for this Instance.public void set_label(AttrValue lvalue)
lvalue - The new label value for this Instance.public double get_weight()
public void display(boolean displayWeight,
boolean normalizeReals)
displayWeight - TRUE if the weight for this Instance should be shown,
FALSE otherwise.normalizeReals - TRUE if the attribute values should be normalized,
FALSE otherwise.
public void display_unlabelled(boolean displayWeight,
boolean normalizeReal)
normalizeReal - TRUE if the attribute values should be normalized,
FALSE otherwise.displayWeight - TRUE if the weight for this Instance should be shown,
FALSE otherwise.public boolean is_labelled()
public boolean is_labelled(boolean fatalOnFalse)
fatalOnFalse - TRUE if an Error message should be displayed if there
is no label for this Instance, FALSE otherwise.public AttrInfo label_info()
public java.lang.String toString()
public AttrInfo attr_info(int attrNum)
attrNum - The index of the attribute specified.public boolean equals(Instance i_instance)
i_instance - The Instance to be compared to.
public java.lang.String out(boolean displayWeight,
boolean normalizeReals)
displayWeight - TRUE if the Instance weight is to be displayed, FALSE otherwise.normalizeReals - TRUE if the real values in the Instance are to be normalized, FALSE otherwise.
public java.lang.String display_unlabelled_out(boolean displayWeight,
boolean normalizeReal)
displayWeight - TRUE if the Instance weight is to be displayed, FALSE otherwise.normalizeReal - TRUE if the real values in the Instance are to be normalized, FALSE otherwise.public AttrValue index(int index)
index - The index specified.
public void copy(Instance other)
throws java.lang.CloneNotSupportedException
other - The Instance object to be copied.
public Instance remove_attr(int attrNum,
Schema schemaWithDelAttr)
attrNum - The number of the attribute to be removed from this InstanceObject.schemaWithDelAttr - Schema with the attribute deleted.public Instance remove_attr(int attrNum)
attrNum - The number of the attribute to be removed from this InstanceObject.public int num_attr_values(int attrNum)
attrNum - The number of the attribute for which the number of values is requested.public int num_label_values()
public NominalAttrInfo nominal_label_info()
public java.lang.String attr_name(int attrNum)
attrNum - The number of the attribute.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||