Instance
, MultiLabelInstance
, java.io.Serializable
DenseInstance
, MultilabelInstance
, SparseInstance
public class InstanceImpl extends java.lang.Object implements MultiLabelInstance
Modifier and Type | Field | Description |
---|---|---|
protected InstanceData |
instanceData |
The instance data.
|
protected InstancesHeader |
instanceHeader |
The instance information.
|
protected double |
weight |
The weight.
|
Constructor | Description |
---|---|
InstanceImpl(double weight,
double[] res) |
Instantiates a new instance.
|
InstanceImpl(double weight,
double[] attributeValues,
int[] indexValues,
int numberAttributes) |
Instantiates a new instance.
|
InstanceImpl(double weight,
InstanceData instanceData) |
Instantiates a new instance.
|
InstanceImpl(int numAttributes) |
Instantiates a new instance.
|
InstanceImpl(InstanceImpl inst) |
Instantiates a new instance.
|
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 instAttIndex) |
Gets the value of an output attribute.
|
Instance |
copy() |
Copy.
|
Instances |
dataset() |
Dataset.
|
void |
deleteAttributeAt(int i) |
Delete attribute at.
|
int |
index(int i) |
Index.
|
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 is missing.
|
boolean |
isMissing(Attribute attribute) |
Checks if an attribute is missing.
|
boolean |
isMissingSparse(int p) |
Checks if is missing sparse.
|
int |
numAttributes() |
Num 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() |
Num values.
|
Attribute |
outputAttribute(int outputIndex) |
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 missing
|
void |
setMissing(Attribute attribute) |
Sets an attribute as missing
|
void |
setValue(int numAttribute,
double d) |
Sets the value.
|
void |
setValue(Attribute attribute,
double value) |
Sets the value of an attribute.
|
void |
setWeight(double weight) |
Sets the weight.
|
java.lang.String |
stringValue(int i) |
String value.
|
double[] |
toDoubleArray() |
To double array.
|
java.lang.String |
toString() |
Text representation of a InstanceImpl.
|
double |
value(int instAttIndex) |
Value.
|
double |
value(Attribute attribute) |
Value.
|
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) |
Value sparse.
|
double |
weight() |
Weight.
|
protected double weight
protected InstanceData instanceData
protected InstancesHeader instanceHeader
public InstanceImpl(InstanceImpl inst)
inst
- the instpublic InstanceImpl(double weight, double[] res)
weight
- the weightres
- the respublic InstanceImpl(double weight, double[] attributeValues, int[] indexValues, int numberAttributes)
weight
- the weightattributeValues
- the attribute valuesindexValues
- the index valuesnumberAttributes
- the number attributespublic InstanceImpl(double weight, InstanceData instanceData)
weight
- the weightinstanceData
- the instance datapublic InstanceImpl(int numAttributes)
numAttributes
- the num attributespublic double weight()
public void setWeight(double weight)
public Attribute attribute(int instAttIndex)
public int indexOfAttribute(Attribute attribute)
Instance
indexOfAttribute
in interface Instance
public void deleteAttributeAt(int i)
deleteAttributeAt
in interface Instance
i
- the ipublic void insertAttributeAt(int i)
insertAttributeAt
in interface Instance
i
- the ipublic int numAttributes()
numAttributes
in interface Instance
public double value(int instAttIndex)
public boolean isMissing(int instAttIndex)
public int numValues()
public int index(int i)
public double valueSparse(int i)
valueSparse
in interface Instance
i
- the ipublic boolean isMissingSparse(int p)
isMissingSparse
in interface Instance
p
- the ppublic double value(Attribute attribute)
public java.lang.String stringValue(int i)
stringValue
in interface Instance
i
- the ipublic double[] toDoubleArray()
toDoubleArray
in interface Instance
public void setValue(int numAttribute, double d)
public double classValue()
classValue
in interface Instance
public int classIndex()
classIndex
in interface Instance
public int numClasses()
numClasses
in interface Instance
public boolean classIsMissing()
classIsMissing
in interface Instance
public Attribute classAttribute()
classAttribute
in interface Instance
public void setClassValue(double d)
setClassValue
in interface Instance
d
- the new class valuepublic Instances dataset()
public void setDataset(Instances dataset)
setDataset
in interface Instance
dataset
- the new datasetpublic void addSparseValues(int[] indexValues, double[] attributeValues, int numberAttributes)
addSparseValues
in interface Instance
indexValues
- the index valuesattributeValues
- the attribute valuesnumberAttributes
- the number attributespublic java.lang.String toString()
toString
in class java.lang.Object
public int numInputAttributes()
Instance
numInputAttributes
in interface Instance
public int numOutputAttributes()
Instance
numOutputAttributes
in interface Instance
public int numberOutputTargets()
Instance
numberOutputTargets
in interface Instance
public double classValue(int instAttIndex)
Instance
classValue
in interface Instance
instAttIndex
- the indexpublic void setClassValue(int indexClass, double valueAttribute)
Instance
setClassValue
in interface Instance
indexClass
- the output attribute indexvalueAttribute
- the value of the attributepublic Attribute outputAttribute(int outputIndex)
Instance
outputAttribute
in interface Instance
outputIndex
- the indexpublic Attribute inputAttribute(int attributeIndex)
Instance
inputAttribute
in interface Instance
attributeIndex
- the indexpublic double valueInputAttribute(int attributeIndex)
Instance
valueInputAttribute
in interface Instance
attributeIndex
- the indexpublic double valueOutputAttribute(int attributeIndex)
Instance
valueOutputAttribute
in interface Instance
attributeIndex
- the indexpublic void setMissing(int instAttIndex)
Instance
setMissing
in interface Instance
instAttIndex
- , the attribute's indexpublic void setMissing(Attribute attribute)
Instance
setMissing
in interface Instance
attribute
- , the Attributepublic boolean isMissing(Attribute attribute)
Instance
Copyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.