|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.core.AbstractInstance
public abstract class AbstractInstance
Abstract class providing common functionality for the original instance implementations.
| Constructor Summary | |
|---|---|
AbstractInstance()
|
|
| Method Summary | |
|---|---|
Attribute |
attribute(int index)
Returns the attribute with the given index. |
Attribute |
attributeSparse(int indexOfIndex)
Returns the attribute with the given index in the sparse representation. |
Attribute |
classAttribute()
Returns class attribute. |
int |
classIndex()
Returns the class attribute's index. |
boolean |
classIsMissing()
Tests if an instance's class is missing. |
double |
classValue()
Returns an instance's class value in internal format. |
Instances |
dataset()
Returns the dataset this instance has access to. |
void |
deleteAttributeAt(int position)
Deletes an attribute at the given position (0 to numAttributes() - 1). |
Enumeration |
enumerateAttributes()
Returns an enumeration of all the attributes. |
boolean |
equalHeaders(Instance inst)
Tests if the headers of two instances are equivalent. |
String |
equalHeadersMsg(Instance inst)
Checks if the headers of two instances are equivalent. |
String |
getRevision()
Returns the revision string. |
boolean |
hasMissingValue()
Tests whether an instance has a missing value. |
void |
insertAttributeAt(int position)
Inserts an attribute at the given position (0 to numAttributes()). |
boolean |
isMissing(Attribute att)
Tests if a specific value is "missing". |
boolean |
isMissing(int attIndex)
Tests if a specific value is "missing". |
boolean |
isMissingSparse(int indexOfIndex)
Tests if a specific value is "missing", given an index in the sparse representation. |
int |
numClasses()
Returns the number of class labels. |
Instances |
relationalValue(Attribute att)
Returns the relational value of a relational attribute. |
Instances |
relationalValue(int attIndex)
Returns the relational value of a relational attribute. |
void |
setClassMissing()
Sets the class value of an instance to be "missing". |
void |
setClassValue(double value)
Sets the class value of an instance to the given value (internal floating-point format). |
void |
setClassValue(String value)
Sets the class value of an instance to the given value. |
void |
setDataset(Instances instances)
Sets the reference to the dataset. |
void |
setMissing(Attribute att)
Sets a specific value to be "missing". |
void |
setMissing(int attIndex)
Sets a specific value to be "missing". |
void |
setValue(Attribute att,
double value)
Sets a specific value in the instance to the given value (internal floating-point format). |
void |
setValue(Attribute att,
String value)
Sets a value of an nominal or string attribute to the given value. |
void |
setValue(int attIndex,
String value)
Sets a value of a nominal or string attribute to the given value. |
void |
setWeight(double weight)
Sets the weight of an instance. |
String |
stringValue(Attribute att)
Returns the value of a nominal, string, date, or relational attribute for the instance as a string. |
String |
stringValue(int attIndex)
Returns the value of a nominal, string, date, or relational attribute for the instance as a string. |
String |
toString()
Returns the description of one instance. |
String |
toString(Attribute att)
Returns the description of one value of the instance as a string. |
String |
toString(int attIndex)
Returns the description of one value of the instance as a string. |
double |
value(Attribute att)
Returns an instance's attribute value in internal format. |
double |
valueSparse(int indexOfIndex)
Returns an instance's attribute value in internal format, given an index in the sparse representation. |
double |
weight()
Returns the instance's weight. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface weka.core.Instance |
|---|
index, mergeInstance, numAttributes, numValues, replaceMissingValues, setValue, setValueSparse, toDoubleArray, toStringNoWeight, value |
| Methods inherited from interface weka.core.Copyable |
|---|
copy |
| Constructor Detail |
|---|
public AbstractInstance()
| Method Detail |
|---|
public Attribute attribute(int index)
attribute in interface Instanceindex - the attribute's index
UnassignedDatasetException - if instance doesn't have access to a
datasetpublic Attribute attributeSparse(int indexOfIndex)
attributeSparse in interface InstanceindexOfIndex - the index of the attribute's index
UnassignedDatasetException - if instance doesn't have access to a
datasetpublic Attribute classAttribute()
classAttribute in interface InstanceUnassignedDatasetException - if the class is not set or the
instance doesn't have access to a datasetpublic int classIndex()
classIndex in interface InstanceUnassignedDatasetException - if instance doesn't have access to a datasetpublic boolean classIsMissing()
classIsMissing in interface InstanceUnassignedClassException - if the class is not set or the instance doesn't
have access to a datasetpublic double classValue()
classValue in interface InstanceUnassignedClassException - if the class is not set or the instance doesn't
have access to a datasetpublic Instances dataset()
dataset in interface Instancepublic void deleteAttributeAt(int position)
deleteAttributeAt in interface Instanceposition - the attribute's position
RuntimeException - if the instance has access to a
datasetpublic Enumeration enumerateAttributes()
enumerateAttributes in interface InstanceUnassignedDatasetException - if the instance doesn't
have access to a datasetpublic boolean equalHeaders(Instance inst)
equalHeaders in interface Instanceinst - another instance
UnassignedDatasetException - if instance doesn't have access to any
datasetpublic String equalHeadersMsg(Instance inst)
equalHeadersMsg in interface Instancedataset - another instance
public boolean hasMissingValue()
hasMissingValue in interface InstanceUnassignedDatasetException - if instance doesn't have access to any
datasetpublic void insertAttributeAt(int position)
insertAttributeAt in interface Instanceposition - the attribute's position
RuntimeException - if the instance has accesss to a
dataset
IllegalArgumentException - if the position is out of rangepublic boolean isMissing(int attIndex)
isMissing in interface InstanceattIndex - the attribute's index
public boolean isMissingSparse(int indexOfIndex)
isMissingSparse in interface InstanceindexOfIndex - the index of the attribute's index
public boolean isMissing(Attribute att)
isMissing in interface Instanceatt - the attribute
public int numClasses()
numClasses in interface InstanceUnassignedDatasetException - if instance doesn't have access to any
datasetpublic void setClassMissing()
setClassMissing in interface InstanceUnassignedClassException - if the class is not set
UnassignedDatasetException - if the instance doesn't
have access to a datasetpublic void setClassValue(double value)
setClassValue in interface Instancevalue - the new attribute value (If the corresponding
attribute is nominal (or a string) then this is the new value's
index as a double).
UnassignedClassException - if the class is not set
UnaddignedDatasetException - if the instance doesn't
have access to a datasetpublic final void setClassValue(String value)
setClassValue in interface Instancevalue - the new class value (If the class
is a string attribute and the value can't be found,
the value is added to the attribute).
UnassignedClassException - if the class is not set
UnassignedDatasetException - if the dataset is not set
IllegalArgumentException - if the attribute is not
nominal or a string, or the value couldn't be found for a nominal
attributepublic final void setDataset(Instances instances)
setDataset in interface Instanceinstances - the reference to the datasetpublic final void setMissing(int attIndex)
setMissing in interface InstanceattIndex - the attribute's indexpublic final void setMissing(Attribute att)
setMissing in interface Instanceatt - the attribute
public final void setValue(int attIndex,
String value)
setValue in interface InstanceattIndex - the attribute's indexvalue - the new attribute value (If the attribute
is a string attribute and the value can't be found,
the value is added to the attribute).
UnassignedDatasetException - if the dataset is not set
IllegalArgumentException - if the selected
attribute is not nominal or a string, or the supplied value couldn't
be found for a nominal attribute
public final void setValue(Attribute att,
double value)
setValue in interface Instanceatt - the attributevalue - the new attribute value (If the corresponding
attribute is nominal (or a string) then this is the new value's
index as a double).
public final void setValue(Attribute att,
String value)
setValue in interface Instanceatt - the attributevalue - the new attribute value (If the attribute
is a string attribute and the value can't be found,
the value is added to the attribute).
IllegalArgumentException - if the the attribute is not
nominal or a string, or the value couldn't be found for a nominal
attributepublic final void setWeight(double weight)
setWeight in interface Instanceweight - the weightpublic final Instances relationalValue(int attIndex)
relationalValue in interface InstanceattIndex - the attribute's index
IllegalArgumentException - if the attribute is not a
relation-valued attribute
UnassignedDatasetException - if the instance doesn't belong
to a dataset.public final Instances relationalValue(Attribute att)
relationalValue in interface Instanceatt - the attribute
IllegalArgumentException - if the attribute is not a
relation-valued attribute
UnassignedDatasetException - if the instance doesn't belong
to a dataset.public final String stringValue(int attIndex)
stringValue in interface InstanceattIndex - the attribute's index
IllegalArgumentException - if the attribute is not a nominal,
string, date, or relation-valued attribute.
UnassignedDatasetException - if the instance doesn't belong
to a dataset.public final String stringValue(Attribute att)
stringValue in interface Instanceatt - the attribute
IllegalArgumentException - if the attribute is not a nominal,
string, date, or relation-valued attribute.
UnassignedDatasetException - if the instance doesn't belong
to a dataset.public String toString()
toString in class Objectpublic final String toString(int attIndex)
toString in interface InstanceattIndex - the attribute's index
public final String toString(Attribute att)
toString in interface Instanceatt - the attribute
public double value(Attribute att)
value in interface Instanceatt - the attribute
public double valueSparse(int indexOfIndex)
valueSparse in interface InstanceindexOfIndex - the index of the attribute's index
public final double weight()
weight in interface Instancepublic String getRevision()
getRevision in interface RevisionHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||