Documentation of 'jsat.distributions.kernels.KernelPoint' Java class
KernelPoint
jsat.distributions.kernels

Class KernelPoint



  • public class KernelPoint
    extends java.lang.Object
    The Kernel Point represents a kernelized weight vector by a linear combination of vectors transformed through a kernel fuctiion. This implementation allows the selection of multiple different budget maintenance strategies

    See KernelRLS and Projectron for methods and papers based on the same ideas used to create this class.
    Credit goes to Davis King of the dlib library for the idea of this type of class.

    Changing the budget maintinance method or other parameters should be done before adding any data points to the KernelPoint.
    If a maximum budget is specified, it may always be increased - but may not be decreased.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  KernelPoint.BudgetStrategy
      These enums control the method used to reduce the size of the support vector set in the kernel point.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      KernelPoint clone() 
      double dist(KernelPoint x)
      Computes the Euclidean distance between this kernel point and the given kernel point in the kernel space
      double dist(Vec x)
      Computes the Euclidean distance between this kernel point and the given input in the kernel space
      double dist(Vec x, java.util.List<java.lang.Double> qi)
      Computes the Euclidean distance between this kernel point and the given input in the kernel space
      double dot(KernelPoint x)
      Returns the dot product between this point and another in the kernel space
      double dot(Vec x)
      Computes the dot product between the kernel point this object represents and the given input vector in the kernel space.
      double dot(Vec x, java.util.List<java.lang.Double> qi)
      Computes the dot product between the kernel point this object represents and the given input vector in the kernel space
      int getBasisSize()
      Returns the number of vectors serving as the basis set
      KernelPoint.BudgetStrategy getBudgetStrategy()
      Returns the budget method used
      double getErrorTolerance()
      Returns the error tolerance that is used depending on the KernelPoint.BudgetStrategy in use
      int getMaxBudget()
      Returns the current maximum budget for support vectors
      java.util.List<Vec> getRawBasisVecs()
      Returns the list of the raw vectors being used by the kernel points.
      double getSqrdNorm()
      Returns the squared values of the 2 norm of the point this object represents
      void mutableAdd(double c, Vec x_t)
      Alters this point to contain the given input vector as well
      void mutableAdd(double c, Vec x_t, java.util.List<java.lang.Double> qi)
      Alters this point to contain the given input vector as well
      void mutableAdd(Vec x_t)
      Alters this point to contain the given input vector as well
      void mutableMultiply(double c)
      Alters this point to be multiplied by the given value
      void setBudgetStrategy(KernelPoint.BudgetStrategy budgetStrategy)
      Sets the method used for maintaining the budget of support vectors.
      void setErrorTolerance(double errorTolerance)
      Sets the error tolerance used for projection maintenance strategies such as KernelPoint.BudgetStrategy.PROJECTION
      void setMaxBudget(int maxBudget)
      Sets the maximum budget for support vectors to allow.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KernelPoint

        public KernelPoint(KernelTrick k,
                           double errorTolerance)
        Creates a new Kernel Point, which is a point in the kernel space represented by an accumulation of vectors and uses the KernelPoint.BudgetStrategy.PROJECTION strategy with an unbounded maximum budget
        Parameters:
        k - the kernel to use
        errorTolerance - the maximum error in [0, 1] allowed for projecting a vector instead of adding it to the basis set
      • KernelPoint

        public KernelPoint(KernelPoint toCopy)
        Copy constructor
        Parameters:
        toCopy - the object to copy
    • Method Detail

      • setMaxBudget

        public void setMaxBudget(int maxBudget)
        Sets the maximum budget for support vectors to allow. Setting to Integer.MAX_VALUE is essentially an unbounded number of support vectors. Increasing the budget after adding the first vector is always allowed, but it may not be possible to reduce the number of current support vectors is above the desired budget.
        Parameters:
        maxBudget - the maximum number of allowed support vectors
      • getMaxBudget

        public int getMaxBudget()
        Returns the current maximum budget for support vectors
        Returns:
        the maximum budget for support vectors
      • setBudgetStrategy

        public void setBudgetStrategy(KernelPoint.BudgetStrategy budgetStrategy)
        Sets the method used for maintaining the budget of support vectors. This method must be called before any vectors are added to the KernelPoint.

        The budget maintenance strategy used controls the time complexity and memory use of the model.
        Parameters:
        budgetStrategy - the budget maintenance strategy
      • getBudgetStrategy

        public KernelPoint.BudgetStrategy getBudgetStrategy()
        Returns the budget method used
        Returns:
        the budget method used
      • setErrorTolerance

        public void setErrorTolerance(double errorTolerance)
        Sets the error tolerance used for projection maintenance strategies such as KernelPoint.BudgetStrategy.PROJECTION
        Parameters:
        errorTolerance - the error tolerance in [0, 1]
      • getErrorTolerance

        public double getErrorTolerance()
        Returns the error tolerance that is used depending on the KernelPoint.BudgetStrategy in use
        Returns:
        the error tolerance value
      • getSqrdNorm

        public double getSqrdNorm()
        Returns the squared values of the 2 norm of the point this object represents
        Returns:
        the squared value of the 2 norm
      • dot

        public double dot(Vec x)
        Computes the dot product between the kernel point this object represents and the given input vector in the kernel space.
        Parameters:
        x - the input vector to work with
        Returns:
        the dot product in the kernel space between this point and x
      • dot

        public double dot(Vec x,
                          java.util.List<java.lang.Double> qi)
        Computes the dot product between the kernel point this object represents and the given input vector in the kernel space
        Parameters:
        x - the input vector to work with
        qi - the query information for the vector, or null only if the kernel in use does not support acceleration.
        Returns:
        the dot product in the kernel space between this point and x
      • dot

        public double dot(KernelPoint x)
        Returns the dot product between this point and another in the kernel space
        Parameters:
        x - the point to take the dot product with
        Returns:
        the dot product in the kernel space between this point and x
      • dist

        public double dist(Vec x)
        Computes the Euclidean distance between this kernel point and the given input in the kernel space
        Parameters:
        x - the input vector to work with
        Returns:
        the Euclidean distance between this point and x in the kernel space
      • dist

        public double dist(Vec x,
                           java.util.List<java.lang.Double> qi)
        Computes the Euclidean distance between this kernel point and the given input in the kernel space
        Parameters:
        x - the input vector to work with
        qi - the query information for the vector, or null only if the kernel in use does not support acceleration.
        Returns:
        the Euclidean distance between this point and x in the kernel space
      • dist

        public double dist(KernelPoint x)
        Computes the Euclidean distance between this kernel point and the given kernel point in the kernel space
        Parameters:
        x - the input point to work with
        Returns:
        the Euclidean distance between this point and x in the kernel space
      • mutableMultiply

        public void mutableMultiply(double c)
        Alters this point to be multiplied by the given value
        Parameters:
        c - the value to multiply by
      • mutableAdd

        public void mutableAdd(Vec x_t)
        Alters this point to contain the given input vector as well
        Parameters:
        x_t - the vector to add
      • mutableAdd

        public void mutableAdd(double c,
                               Vec x_t)
        Alters this point to contain the given input vector as well
        Parameters:
        c - the multiplicative constant to apply with the vector
        x_t - the vector to add
      • mutableAdd

        public void mutableAdd(double c,
                               Vec x_t,
                               java.util.List<java.lang.Double> qi)
        Alters this point to contain the given input vector as well
        Parameters:
        c - the multiplicative constant to apply with the vector
        x_t - the vector to add
        qi - the query information for the vector, or null only if the kernel in use does not support acceleration.
      • getBasisSize

        public int getBasisSize()
        Returns the number of vectors serving as the basis set
        Returns:
        the number of vectors serving as the basis set
      • getRawBasisVecs

        public java.util.List<Vec> getRawBasisVecs()
        Returns the list of the raw vectors being used by the kernel points. Altering this vectors will alter the same vectors used by the KernelPoint and will cause inconsistent results.

        The returned list may not be modified
        Returns:
        a the list of all the vectors in use as a basis set by this KernelPoint
      • clone

        public KernelPoint clone()
        Overrides:
        clone in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.