Documentation of 'jsat.linear.Poly2Vec' Java class
Poly2Vec
jsat.linear

Class Poly2Vec

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<IndexValue>


    public class Poly2Vec
    extends Vec
    This class is used to create an implicit representation of the degree 2 polynomial of an input vector, with an implicit bias term added so that the original vector values are present in the implicit vector. This means no extra memory will be allocated, and all values accessed will be re-computed as needed. This works with sparse vectors, and work bet with algorithms that iterate over the nonzero values once.

    Any change in the base vector will change the values in this vector. Because changing one value in the base effects multiple values in this one, altering this vector directly is not allowed.

    If the base vector has N non zero values, then this vec will have O(N2) non zero values. (N+2)(N+1)/2 non zero values to be exact.
    See Also:
    Serialized Form
    • Constructor Detail

      • Poly2Vec

        public Poly2Vec(Vec base)
    • Method Detail

      • setBase

        public void setBase(Vec base)
        Creates a new vector that implicitly represents the degree 2 polynomial of the base vector.
        Parameters:
        base - the base vector
      • length

        public int length()
        Description copied from class: Vec
        Returns the length of this vector
        Specified by:
        length in class Vec
        Returns:
        the length of this vector
      • nnz

        public int nnz()
        Description copied from class: Vec
        Computes the number of non zero values in this vector
        Overrides:
        nnz in class Vec
        Returns:
        the number of non zero values stored
      • get

        public double get(int index)
        Description copied from class: Vec
        Gets the value stored at a specific index in the vector
        Specified by:
        get in class Vec
        Parameters:
        index - the index to access
        Returns:
        the double value in the vector
      • set

        public void set(int index,
                        double val)
        Description copied from class: Vec
        Sets the value stored at a specified index in the vector
        Specified by:
        set in class Vec
        Parameters:
        index - the index to access
        val - the value to store in the index
      • isSparse

        public boolean isSparse()
        Description copied from class: Vec
        Indicates whether or not this vector is optimized for sparce computation, meaning that most values in the vector are zero - and considered implicit. Only non-zero values are stored.
        Specified by:
        isSparse in class Vec
        Returns:
        true if the vector is sparce, false otherwise.
      • clone

        public Vec clone()
        Specified by:
        clone in class Vec
      • getNonZeroIterator

        public java.util.Iterator<IndexValue> getNonZeroIterator(int start)
        Description copied from class: Vec
        Returns an iterator that will go over the non zero values starting from the specified index in the given vector. The iterator does not support the Iterator.remove() method.

        This method should be overloaded for a serious implementation.
        Overrides:
        getNonZeroIterator in class Vec
        Parameters:
        start - the first index (inclusive) to start returning non-zero values from
        Returns:
        an iterator for the non zero index value pairs

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.