public class BinarySparseInstance extends SparseInstance
s_numericAfterDecimalPoint
Constructor and Description |
---|
BinarySparseInstance(double weight,
double[] attValues)
Constructor that generates a sparse instance from the given parameters.
|
BinarySparseInstance(double weight,
int[] indices,
int maxNumValues)
Constructor that inititalizes instance variable with given values.
|
BinarySparseInstance(Instance instance)
Constructor that generates a sparse instance from the given instance.
|
BinarySparseInstance(int numAttributes)
Constructor of an instance that sets weight to one, all values to 1, and
the reference to the dataset to null.
|
BinarySparseInstance(SparseInstance instance)
Constructor that copies the info from the given instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
copy()
Produces a shallow copy of this instance.
|
Instance |
copy(double[] values)
Copies the instance but fills up its values based on the given array
of doubles.
|
java.lang.String |
getRevision()
Returns the revision string.
|
static void |
main(java.lang.String[] options)
Main method for testing this class.
|
Instance |
mergeInstance(Instance inst)
Merges this instance with the given instance and returns the result.
|
void |
replaceMissingValues(double[] array)
Does nothing, since we don't support missing values.
|
void |
setValue(int attIndex,
double value)
Sets a specific value in the instance to the given value (internal
floating-point format).
|
void |
setValueSparse(int indexOfIndex,
double value)
Sets a specific value in the instance to the given value (internal
floating-point format).
|
double[] |
toDoubleArray()
Returns the values of each attribute as an array of doubles.
|
java.lang.String |
toString()
Returns the description of one instance in sparse format.
|
double |
value(int attIndex)
Returns an instance's attribute value in internal format.
|
double |
valueSparse(int indexOfIndex)
Returns an instance's attribute value in internal format.
|
index, locateIndex, numAttributes, numValues, toStringNoWeight, toStringNoWeight
attribute, attributeSparse, classAttribute, classIndex, classIsMissing, classValue, dataset, deleteAttributeAt, enumerateAttributes, equalHeaders, equalHeadersMsg, hasMissingValue, insertAttributeAt, isMissing, isMissing, isMissingSparse, numClasses, relationalValue, relationalValue, setClassMissing, setClassValue, setClassValue, setDataset, setMissing, setMissing, setValue, setValue, setValue, setWeight, stringValue, stringValue, toString, toString, toString, toString, toStringMaxDecimalDigits, value, weight
public BinarySparseInstance(Instance instance)
instance
- the instance from which the attribute values and the weight
are to be copiedpublic BinarySparseInstance(SparseInstance instance)
instance
- the instance from which the attribute info is to be copiedpublic BinarySparseInstance(double weight, double[] attValues)
weight
- the instance's weightattValues
- a vector of attribute valuespublic BinarySparseInstance(double weight, int[] indices, int maxNumValues)
weight
- the instance's weightindices
- the indices of the given values in the full vectormaxNumValues
- the maximium number of values that can be storedpublic BinarySparseInstance(int numAttributes)
numAttributes
- the size of the instancepublic java.lang.Object copy()
new BinarySparseInstance(instance)
copy
in interface Copyable
copy
in class SparseInstance
public Instance copy(double[] values)
copy
in interface Instance
copy
in class SparseInstance
values
- the array with new valuespublic Instance mergeInstance(Instance inst)
mergeInstance
in interface Instance
mergeInstance
in class SparseInstance
inst
- the instance to be merged with this onepublic void replaceMissingValues(double[] array)
replaceMissingValues
in interface Instance
replaceMissingValues
in class SparseInstance
array
- containing the means and modespublic void setValue(int attIndex, double value)
setValue
in interface Instance
setValue
in class SparseInstance
attIndex
- the attribute's indexvalue
- 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 void setValueSparse(int indexOfIndex, double value)
setValueSparse
in interface Instance
setValueSparse
in class SparseInstance
indexOfIndex
- the index of the attribute's indexvalue
- 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 double[] toDoubleArray()
toDoubleArray
in interface Instance
toDoubleArray
in class SparseInstance
public java.lang.String toString()
toString
in class AbstractInstance
public double value(int attIndex)
value
in interface Instance
value
in class SparseInstance
attIndex
- the attribute's indexpublic final double valueSparse(int indexOfIndex)
valueSparse
in interface Instance
valueSparse
in class AbstractInstance
indexOfIndex
- the index of the attribute's indexpublic static void main(java.lang.String[] options)
options
- the command line options - ignoredpublic java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class SparseInstance