Package com.yahoo.labs.samoa.instances
Interface Instance
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
MultiLabelInstance
- All Known Implementing Classes:
CMM_GTAnalysis.CMMPoint
,DataPoint
,DenseInstance
,FilteredSparseInstance
,InstanceImpl
,MultilabelInstance
,SparseInstance
public interface Instance extends Serializable
The Interface Instance.- Author:
- abifet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addSparseValues(int[] indexValues, double[] attributeValues, int numberAttributes)
Adds the sparse values.Attribute
attribute(int instAttIndex)
Attribute.Attribute
classAttribute()
Class attribute.int
classIndex()
Class index.boolean
classIsMissing()
Class is missing.double
classValue()
Class value.double
classValue(int attributeIndex)
Gets the value of an output attribute.Instance
copy()
Copy.Instances
dataset()
Dataset.void
deleteAttributeAt(int i)
Delete attribute at.int
index(int arrayIndex)
Gets the index of the attribute given the index of the array in a sparse representation.int
indexOfAttribute(Attribute attribute)
Index of an Attribute.Attribute
inputAttribute(int attributeIndex)
Gets an input attribute given its index.void
insertAttributeAt(int i)
Insert attribute at.boolean
isMissing(int instAttIndex)
Checks if an attribute is missing.boolean
isMissing(Attribute attribute)
Checks if an attribute is missing.boolean
isMissingSparse(int p1)
Checks if the attribute is missing sparse.int
numAttributes()
Gets the number of attributes.int
numberOutputTargets()
Gets the number of output attributes.int
numClasses()
Num classes.int
numInputAttributes()
Gets the number of input attributes.int
numOutputAttributes()
Gets the number of output attributes.int
numValues()
Gets the number of values, mainly for sparse instances.Attribute
outputAttribute(int attributeIndex)
Gets an output attribute given its index.void
setClassValue(double d)
Sets the class value.void
setClassValue(int indexClass, double valueAttribute)
Sets the value of an output attribute.void
setDataset(Instances dataset)
Sets the dataset.void
setMissing(int instAttIndex)
Sets an attribute as missingvoid
setMissing(Attribute attribute)
Sets an attribute as missingvoid
setValue(int instAttIndex, double value)
Sets the value of an attribute.void
setValue(Attribute attribute, double value)
Sets the value of an attribute.void
setWeight(double weight)
Sets the weight.String
stringValue(int i)
Gets the value of a discrete attribute as a string.double[]
toDoubleArray()
To double array.double
value(int instAttIndex)
Gets the value of an attribute.double
value(Attribute attribute)
Gets the value of an attribute, given the attribute.double
valueInputAttribute(int attributeIndex)
Gets the value of an input attribute.double
valueOutputAttribute(int attributeIndex)
Gets the value of an output attribute.double
valueSparse(int i)
Gets the value of an attribute in a sparse representation of the instance.double
weight()
Gets the weight of the instance.
-
-
-
Method Detail
-
weight
double weight()
Gets the weight of the instance.- Returns:
- the weight
-
setWeight
void setWeight(double weight)
Sets the weight.- Parameters:
weight
- the new weight
-
attribute
Attribute attribute(int instAttIndex)
Attribute.- Parameters:
instAttIndex
- the inst att index- Returns:
- the attribute
-
indexOfAttribute
int indexOfAttribute(Attribute attribute)
Index of an Attribute.- Parameters:
attribute
- the attribute to be found.- Returns:
- the index of an attribute
-
deleteAttributeAt
void deleteAttributeAt(int i)
Delete attribute at.- Parameters:
i
- the index
-
insertAttributeAt
void insertAttributeAt(int i)
Insert attribute at.- Parameters:
i
- the index
-
numAttributes
int numAttributes()
Gets the number of attributes.- Returns:
- the number of attributes
-
addSparseValues
void addSparseValues(int[] indexValues, double[] attributeValues, int numberAttributes)
Adds the sparse values.- Parameters:
indexValues
- the index valuesattributeValues
- the attribute valuesnumberAttributes
- the number attributes
-
numValues
int numValues()
Gets the number of values, mainly for sparse instances.- Returns:
- the number of values
-
stringValue
String stringValue(int i)
Gets the value of a discrete attribute as a string.- Parameters:
i
- the i- Returns:
- the string
-
value
double value(int instAttIndex)
Gets the value of an attribute.- Parameters:
instAttIndex
- the inst att index- Returns:
- the double
-
value
double value(Attribute attribute)
Gets the value of an attribute, given the attribute.- Parameters:
attribute
- the attribute- Returns:
- the double
-
setMissing
void setMissing(int instAttIndex)
Sets an attribute as missing- Parameters:
instAttIndex
- , the attribute's index
-
setMissing
void setMissing(Attribute attribute)
Sets an attribute as missing- Parameters:
attribute
- , the Attribute
-
setValue
void setValue(int instAttIndex, double value)
Sets the value of an attribute.- Parameters:
instAttIndex
- the indexvalue
- the value
-
setValue
void setValue(Attribute attribute, double value)
Sets the value of an attribute.- Parameters:
attribute
- , the Attributevalue
- the value
-
isMissing
boolean isMissing(int instAttIndex)
Checks if an attribute is missing.- Parameters:
instAttIndex
- the inst att index- Returns:
- true, if is missing
-
isMissing
boolean isMissing(Attribute attribute)
Checks if an attribute is missing.- Parameters:
attribute
- , the Attribute- Returns:
- true, if is missing
-
index
int index(int arrayIndex)
Gets the index of the attribute given the index of the array in a sparse representation.- Parameters:
arrayIndex
- the index of the array- Returns:
- the index
-
valueSparse
double valueSparse(int i)
Gets the value of an attribute in a sparse representation of the instance.- Parameters:
i
- the i- Returns:
- the value
-
isMissingSparse
boolean isMissingSparse(int p1)
Checks if the attribute is missing sparse.- Parameters:
p1
- the p1- Returns:
- true, if is missing sparse
-
toDoubleArray
double[] toDoubleArray()
To double array.- Returns:
- the double[]
-
classAttribute
Attribute classAttribute()
Class attribute.- Returns:
- the attribute
-
classIndex
int classIndex()
Class index.- Returns:
- the int
-
classIsMissing
boolean classIsMissing()
Class is missing.- Returns:
- true, if successful
-
classValue
double classValue()
Class value.- Returns:
- the double
-
numClasses
int numClasses()
Num classes.- Returns:
- the int
-
setClassValue
void setClassValue(double d)
Sets the class value.- Parameters:
d
- the new class value
-
copy
Instance copy()
Copy.- Returns:
- the instance
-
setDataset
void setDataset(Instances dataset)
Sets the dataset.- Parameters:
dataset
- the new dataset
-
dataset
Instances dataset()
Dataset.- Returns:
- the instances
-
numInputAttributes
int numInputAttributes()
Gets the number of input attributes.- Returns:
- the number of input attributes
-
numOutputAttributes
int numOutputAttributes()
Gets the number of output attributes.- Returns:
- the number of output attributes
-
numberOutputTargets
int numberOutputTargets()
Gets the number of output attributes.- Returns:
- the number of output attributes
-
classValue
double classValue(int attributeIndex)
Gets the value of an output attribute.- Parameters:
attributeIndex
- the index- Returns:
- the value
-
setClassValue
void setClassValue(int indexClass, double valueAttribute)
Sets the value of an output attribute.- Parameters:
indexClass
- the output attribute indexvalueAttribute
- the value of the attribute
-
outputAttribute
Attribute outputAttribute(int attributeIndex)
Gets an output attribute given its index.- Parameters:
attributeIndex
- the index- Returns:
- the attribute
-
inputAttribute
Attribute inputAttribute(int attributeIndex)
Gets an input attribute given its index.- Parameters:
attributeIndex
- the index- Returns:
- the attribute
-
valueInputAttribute
double valueInputAttribute(int attributeIndex)
Gets the value of an input attribute.- Parameters:
attributeIndex
- the index- Returns:
- the value
-
valueOutputAttribute
double valueOutputAttribute(int attributeIndex)
Gets the value of an output attribute.- Parameters:
attributeIndex
- the index- Returns:
- the value
-
-