Documentation of 'jsat.datatransform.kernel.Nystrom' Java class
Nystrom
jsat.datatransform.kernel

Class Nystrom

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, DataTransform, Parameterized


    public class Nystrom
    extends DataTransformBase
    An implementation of the Nystrom approximation for any Kernel Trick. The full rank kernel is approximated by a basis set of a subset of the data points that make up the original data set. Instead of explicitly forming the approximately decomposed matrix, this transform projects the original numeric features of a data set into a new feature space where the dot product in the linear space approximates the dot product in the given kernel space.

    See:
    • Williams, C.,&Seeger, M. (2001). Using the Nyström Method to Speed Up Kernel Machines. Advances in Neural Information Processing Systems 13 (pp. 682–688). MIT Press. Retrieved from here
    • Yang, T., Li, Y.-F., Mahdavi, M., Jin, R.,&Zhou, Z.-H. (2012). Nystrom Method vs Random Fourier Features A Theoretical and Empirical Comparison. Advances in Neural Information Processing Systems (pp. 485–493). Retrieved from here
    • Kumar, S., Mohri, M.,&Talwalkar, A. (2012). Sampling methods for the Nyström method. The Journal of Machine Learning Research, 5, 981–1006. Retrieved from here
    See Also:
    Serialized Form
    • Constructor Detail

      • Nystrom

        public Nystrom(KernelTrick k,
                       DataSet dataset,
                       int basisSize,
                       Nystrom.SamplingMethod method)
        Creates a new Nystrom approximation object
        Parameters:
        k - the kernel trick to form an approximation of
        dataset - the data set to form the approximate feature space from
        basisSize - the number of basis vectors to use, this is the output dimension size.
        method - what sampling method should be used to select the basis vectors from the full data set.
      • Nystrom

        public Nystrom()
        Creates a new Nystrom approximation object using the RBF Kernel with 500 basis vectors
      • Nystrom

        public Nystrom(KernelTrick k,
                       int basisSize)
        Creates a new Nystrom approximation object
        Parameters:
        k - the kernel trick to form an approximation of
        basisSize - the number of basis vectors to use, this is the output dimension size.
      • Nystrom

        public Nystrom(KernelTrick k,
                       int basisSize,
                       Nystrom.SamplingMethod method,
                       double ridge,
                       boolean sampleWithReplacment)
        Creates a new Nystrom approximation object
        Parameters:
        k - the kernel trick to form an approximation of
        basisSize - the number of basis vectors to use, this is the output dimension size.
        method - what sampling method should be used to select the basis vectors from the full data set.
        ridge - a non negative additive term to regularize the eigen values of the decomposition.
        sampleWithReplacment - true if the basis vectors should be sampled with replacement, false if they should not.
      • Nystrom

        public Nystrom(KernelTrick k,
                       DataSet dataset,
                       int basisSize,
                       Nystrom.SamplingMethod method,
                       double ridge,
                       boolean sampleWithReplacment)
        Creates a new Nystrom approximation object
        Parameters:
        k - the kernel trick to form an approximation of
        dataset - the data set to form the approximate feature space from
        basisSize - the number of basis vectors to use, this is the output dimension size.
        method - what sampling method should be used to select the basis vectors from the full data set.
        ridge - a non negative additive term to regularize the eigen values of the decomposition.
        sampleWithReplacment - true if the basis vectors should be sampled with replacement, false if they should not.
    • Method Detail

      • fit

        public void fit(DataSet dataset)
        Description copied from interface: DataTransform
        Fits this transform to the given dataset. Some transforms can only be learned from classification or regression datasets. If an incompatible dataset type is given, a FailedToFitException exception may be thrown.
        Parameters:
        dataset - the dataset to fir this transform to
      • sampleBasisVectors

        public static java.util.List<Vec> sampleBasisVectors(KernelTrick k,
                                                             DataSet dataset,
                                                             java.util.List<Vec> X,
                                                             Nystrom.SamplingMethod method,
                                                             int basisSize,
                                                             boolean sampleWithReplacment,
                                                             java.util.Random rand)
        Performs sampling of a data set for a subset of the vectors that make a good set of basis vectors for forming an approximation of a full kernel space. While these methods are motivated from Nystrom's algorithm, they are also useful for others.
        Parameters:
        k - the kernel trick to form the basis for
        dataset - the data set to sample from
        X - the list of vectors from the data set
        method - the sampling method to use
        basisSize - the number of basis vectors to select
        sampleWithReplacment - whether or not the sample with replacement
        rand - the source of randomness for the sampling
        Returns:
        a list of basis vectors sampled from the data set.
        See Also:
        Nystrom.SamplingMethod
      • transform

        public DataPoint transform(DataPoint dp)
        Description copied from interface: DataTransform
        Returns a new data point that is a transformation of the original data point. This new data point is a different object, but may contain the same references as the original data point. It is not guaranteed that you can mutate the transformed point without having a side effect on the original point.
        Parameters:
        dp - the data point to apply a transformation to
        Returns:
        a transformed data point
      • setRidge

        public void setRidge(double ridge)
        Sets the regularization parameter to add to the eigen values of the gram matrix. This can be particularly useful when using a large (500+) number of components.
        Parameters:
        ridge - the non-negative value in [0, ∞) to add to each eigen value
      • getRidge

        public double getRidge()
        Returns the regularization value added to each eigen value
        Returns:
        the regularization value added to each eigen value
      • setDimension

        public void setDimension(int dimension)
        Sets the dimension of the new feature space, which is the number of principal components to select from the kernelized feature space.
        Parameters:
        dimension - the number of dimensions to project down too
      • getDimension

        public int getDimension()
        Returns the number of dimensions to project down too
        Returns:
        the number of dimensions to project down too
      • setBasisSamplingMethod

        public void setBasisSamplingMethod(Nystrom.SamplingMethod method)
        Sets the method of selecting the basis vectors
        Parameters:
        method - the method of selecting the basis vectors
      • getBasisSamplingMethod

        public Nystrom.SamplingMethod getBasisSamplingMethod()
        Returns the method of selecting the basis vectors
        Returns:
        the method of selecting the basis vectors
      • setBasisSize

        public void setBasisSize(int basisSize)
        Sets the basis size for the Kernel PCA to be learned from. Increasing the basis increase the accuracy of the transform, but increased the training time at a cubic rate.
        Parameters:
        basisSize - the number of basis vectors to build Kernel PCA from
      • getBasisSize

        public int getBasisSize()
        Returns the number of basis vectors to use
        Returns:
        the number of basis vectors to use
      • setKernel

        public void setKernel(KernelTrick k)
        Parameters:
        k - the kernel trick to use
      • getKernel

        public KernelTrick getKernel()
        Returns:
        the kernel trick to use

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.