public class InstanceImpl extends Object implements MultiLabelInstance
Modifier and Type | Field and Description |
---|---|
protected int |
age
Shujie Add: The age of a instance for age-aware method.
|
protected InstanceData |
instanceData
The instance data.
|
protected InstancesHeader |
instanceHeader
The instance information.
|
protected double[] |
predictedVotes
Shujie Add: The predicted votes.
|
protected String |
serialNumber
Shujie Add: The serial number of a instance.
|
protected double |
weight
The weight.
|
Constructor and 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(InstanceImpl inst)
Instantiates a new instance.
|
InstanceImpl(int numAttributes)
Instantiates a new instance.
|
Modifier and Type | Method and 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 |
getAge()
Shujie Add:
Age
|
double[] |
getPredictedVotes() |
String |
getSerialNumber()
Shujie Add:
Serial Number
|
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(Attribute attribute)
Checks if an attribute is missing.
|
boolean |
isMissing(int instAttIndex)
Checks if is missing.
|
boolean |
isMissingSparse(int p)
Checks if is missing sparse.
|
void |
keepPredictedVotes(double[] votes)
Shujie Add:
Keep predicted votes for evaluation.
|
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 |
setAge(int age)
Shujie Add:
Sets the age.
|
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(Attribute attribute)
Sets an attribute as missing
|
void |
setMissing(int instAttIndex)
Sets an attribute as missing
|
void |
setSerialNumber(String serialNumber)
Shujie Add:
Sets the serial number.
|
void |
setValue(Attribute attribute,
double value)
Sets the value of an attribute.
|
void |
setValue(int numAttribute,
double d)
Sets the value.
|
void |
setWeight(double weight)
Sets the weight.
|
String |
stringValue(int i)
String value.
|
double[] |
toDoubleArray()
To double array.
|
String |
toString()
Text representation of a InstanceImpl.
|
double |
value(Attribute attribute)
Value.
|
double |
value(int instAttIndex)
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 String serialNumber
protected int age
protected double[] predictedVotes
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 String getSerialNumber()
getSerialNumber
in interface Instance
public void setSerialNumber(String serialNumber)
setSerialNumber
in interface Instance
serialNumber
- public int getAge()
public void setAge(int age)
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 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 String toString()
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
public void setMissing(Attribute attribute)
Instance
setMissing
in interface Instance
public boolean isMissing(Attribute attribute)
Instance
public void setValue(Attribute attribute, double value)
Instance
public void keepPredictedVotes(double[] votes)
Instance
keepPredictedVotes
in interface Instance
public double[] getPredictedVotes()
getPredictedVotes
in interface Instance
Copyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.