public class SparseInstanceData extends Object implements InstanceData
Modifier and Type | Field and Description |
---|---|
protected double[] |
attributeValues
The attribute values.
|
protected int[] |
indexValues
The index values.
|
protected int |
numberAttributes
The number of attributes.
|
Constructor and Description |
---|
SparseInstanceData(double[] attributeValues,
int[] indexValues,
int numberAttributes)
Instantiates a new sparse instance data.
|
SparseInstanceData(int length)
Instantiates a new sparse instance data.
|
Modifier and Type | Method and Description |
---|---|
InstanceData |
copy()
Produces a shallow copy of this instance data.
|
void |
deleteAttributeAt(int position)
Deletes an attribute at the given position (0 to numAttributes() - 1).
|
double[] |
getAttributeValues()
Gets the attribute values.
|
int[] |
getIndexValues()
Gets the index values.
|
int |
getNumberAttributes()
Gets the number attributes.
|
int |
index(int indexAttribute)
Index.
|
void |
insertAttributeAt(int position)
Inserts an attribute.
|
boolean |
isMissing(int indexAttribute)
Checks if is missing.
|
boolean |
isMissingSparse(int indexAttribute)
Checks if is missing sparse.
|
int |
locateIndex(int index)
Locates the greatest index that is not greater than the given index.
|
int |
numAttributes()
Gets the number of attributes.
|
int |
numValues()
Num values.
|
void |
setAttributeValues(double[] attributeValues)
Sets the attribute values.
|
void |
setIndexValues(int[] indexValues)
Sets the index values.
|
void |
setNumberAttributes(int numberAttributes)
Sets the number of attributes.
|
void |
setValue(int attributeIndex,
double d)
Sets the value.
|
double[] |
toDoubleArray()
To double array.
|
double |
value(int indexAttribute)
Value.
|
double |
valueSparse(int indexAttribute)
Value sparse.
|
protected double[] attributeValues
protected int[] indexValues
protected int numberAttributes
public SparseInstanceData(double[] attributeValues, int[] indexValues, int numberAttributes)
attributeValues
- the attribute valuesindexValues
- the index valuesnumberAttributes
- the number attributespublic SparseInstanceData(int length)
length
- the lengthpublic double[] getAttributeValues()
public void setAttributeValues(double[] attributeValues)
attributeValues
- the new attribute valuespublic int[] getIndexValues()
public void setIndexValues(int[] indexValues)
indexValues
- the new index valuespublic int getNumberAttributes()
public void setNumberAttributes(int numberAttributes)
numberAttributes
- the new number attributespublic int numAttributes()
numAttributes
in interface InstanceData
public double value(int indexAttribute)
value
in interface InstanceData
indexAttribute
- the index attributepublic boolean isMissing(int indexAttribute)
isMissing
in interface InstanceData
indexAttribute
- the index attributepublic int numValues()
numValues
in interface InstanceData
public int index(int indexAttribute)
index
in interface InstanceData
indexAttribute
- the index attributepublic double valueSparse(int indexAttribute)
valueSparse
in interface InstanceData
indexAttribute
- the index attributepublic boolean isMissingSparse(int indexAttribute)
isMissingSparse
in interface InstanceData
indexAttribute
- the index attributepublic double[] toDoubleArray()
toDoubleArray
in interface InstanceData
public void setValue(int attributeIndex, double d)
setValue
in interface InstanceData
attributeIndex
- the attribute indexd
- the dpublic int locateIndex(int index)
public void deleteAttributeAt(int position)
deleteAttributeAt
in interface InstanceData
position
- the attribute's positionpublic void insertAttributeAt(int position)
InstanceData
insertAttributeAt
in interface InstanceData
position
- the indespublic InstanceData copy()
InstanceData
copy
in interface InstanceData
Copyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.