Class SparseInstanceData

    • Field Detail

      • attributeValues

        protected double[] attributeValues
        The attribute values.
      • indexValues

        protected int[] indexValues
        The index values.
      • numberAttributes

        protected int numberAttributes
        The number of attributes.
    • Constructor Detail

      • SparseInstanceData

        public SparseInstanceData​(double[] attributeValues,
                                  int[] indexValues,
                                  int numberAttributes)
        Instantiates a new sparse instance data.
        Parameters:
        attributeValues - the attribute values
        indexValues - the index values
        numberAttributes - the number attributes
      • SparseInstanceData

        public SparseInstanceData​(int length)
        Instantiates a new sparse instance data.
        Parameters:
        length - the length
    • Method Detail

      • getAttributeValues

        public double[] getAttributeValues()
        Gets the attribute values.
        Returns:
        the attribute values
      • setAttributeValues

        public void setAttributeValues​(double[] attributeValues)
        Sets the attribute values.
        Parameters:
        attributeValues - the new attribute values
      • getIndexValues

        public int[] getIndexValues()
        Gets the index values.
        Returns:
        the index values
      • setIndexValues

        public void setIndexValues​(int[] indexValues)
        Sets the index values.
        Parameters:
        indexValues - the new index values
      • getNumberAttributes

        public int getNumberAttributes()
        Gets the number attributes.
        Returns:
        the number attributes
      • setNumberAttributes

        public void setNumberAttributes​(int numberAttributes)
        Sets the number of attributes.
        Parameters:
        numberAttributes - the new number attributes
      • numAttributes

        public int numAttributes()
        Gets the number of attributes.
        Specified by:
        numAttributes in interface InstanceData
        Returns:
        the int
      • value

        public double value​(int indexAttribute)
        Value.
        Specified by:
        value in interface InstanceData
        Parameters:
        indexAttribute - the index attribute
        Returns:
        the double
      • isMissing

        public boolean isMissing​(int indexAttribute)
        Checks if is missing.
        Specified by:
        isMissing in interface InstanceData
        Parameters:
        indexAttribute - the index attribute
        Returns:
        true, if is missing
      • numValues

        public int numValues()
        Num values.
        Specified by:
        numValues in interface InstanceData
        Returns:
        the int
      • index

        public int index​(int indexAttribute)
        Index.
        Specified by:
        index in interface InstanceData
        Parameters:
        indexAttribute - the index attribute
        Returns:
        the int
      • valueSparse

        public double valueSparse​(int indexAttribute)
        Value sparse.
        Specified by:
        valueSparse in interface InstanceData
        Parameters:
        indexAttribute - the index attribute
        Returns:
        the double
      • isMissingSparse

        public boolean isMissingSparse​(int indexAttribute)
        Checks if is missing sparse.
        Specified by:
        isMissingSparse in interface InstanceData
        Parameters:
        indexAttribute - the index attribute
        Returns:
        true, if is missing sparse
      • toDoubleArray

        public double[] toDoubleArray()
        To double array.
        Specified by:
        toDoubleArray in interface InstanceData
        Returns:
        the double[]
      • setValue

        public void setValue​(int attributeIndex,
                             double d)
        Sets the value.
        Specified by:
        setValue in interface InstanceData
        Parameters:
        attributeIndex - the attribute index
        d - the d
      • locateIndex

        public int locateIndex​(int index)
        Locates the greatest index that is not greater than the given index.
        Returns:
        the internal index of the attribute index. Returns -1 if no index with this property could be found
      • deleteAttributeAt

        public void deleteAttributeAt​(int position)
        Deletes an attribute at the given position (0 to numAttributes() - 1).
        Specified by:
        deleteAttributeAt in interface InstanceData
        Parameters:
        position - the attribute's position
      • insertAttributeAt

        public void insertAttributeAt​(int position)
        Description copied from interface: InstanceData
        Inserts an attribute.
        Specified by:
        insertAttributeAt in interface InstanceData
        Parameters:
        position - the indes
      • copy

        public InstanceData copy()
        Description copied from interface: InstanceData
        Produces a shallow copy of this instance data.
        Specified by:
        copy in interface InstanceData
        Returns:
        the shallow copy