Documentation of 'jsat.datatransform.JLTransform' Java class
JLTransform
jsat.datatransform

Class JLTransform

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


    public class JLTransform
    extends DataTransformBase
    The Johnson-Lindenstrauss (JL) Transform is a type of random projection down to a lower dimensional space. The goal is, with a high probability, to keep the Euclidean distances between points approximately the same in the original and projected space.
    The JL lemma, with a high probability, bounds the error of a distance computation between two points u and v in the lower dimensional space by (1 ± ε) d(u, v)2, where d is the Euclidean distance. It works best for very high dimension problems, 1000 or more.
    For more information see:
    Achlioptas, D. (2003). Database-friendly random projections: Johnson-Lindenstrauss with binary coins. Journal of Computer and System Sciences, 66(4), 671–687. doi:10.1016/S0022-0000(03)00025-4
    See Also:
    Serialized Form
    • Constructor Detail

      • JLTransform

        public JLTransform()
        Creates a new JL Transform that uses a target dimension of 50 features. This may not be optimal for any particular dataset.
        Parameters:
        k - the target dimension size
      • JLTransform

        public JLTransform(int k)
        Creates a new JL Transform
        Parameters:
        k - the target dimension size
      • JLTransform

        public JLTransform(int k,
                           JLTransform.TransformMode mode)
        Creates a new JL Transform
        Parameters:
        k - the target dimension size
        mode - how to construct the transform
        rand - the source of randomness
      • JLTransform

        public JLTransform(int k,
                           JLTransform.TransformMode mode,
                           boolean inMemory)
        Creates a new JL Transform
        Parameters:
        k - the target dimension size
        mode - how to construct the transform
        inMemory - if false, the matrix will be stored in O(1) memory at the cost of execution time.
    • Method Detail

      • fit

        public void fit(DataSet data)
        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:
        data - the dataset to fir this transform to
      • setMode

        public void setMode(JLTransform.TransformMode mode)
        The JL transform uses a random matrix to project the data, and the mode controls which method is used to construct this matrix.
        Parameters:
        mode - how to construct the transform
      • setInMemory

        public void setInMemory(boolean inMemory)
        Sets whether or not the transform matrix is stored explicitly in memory or not. Explicit storage is often faster, but can be prohibitive for large datasets
        Parameters:
        inMemory - true to explicitly store the transform matrix, false to re-create it on the fly as needed
      • isInMemory

        public boolean isInMemory()
        Returns:
        true if this object will explicitly store the transform matrix, false to re-create it on the fly as needed
      • setProjectedDimension

        public void setProjectedDimension(int k)
        Sets the target dimension size to use for the output
        Parameters:
        k - the dimension after apply the transform
      • getProjectedDimension

        public int getProjectedDimension()
        Returns:
        the dimension after apply the transform
      • 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

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.