Class Projection

java.lang.Object
smile.feature.extraction.Projection
All Implemented Interfaces:
Serializable, Function<Tuple,Tuple>, Transform
Direct Known Subclasses:
GHA, KernelPCA, PCA, ProbabilisticPCA, RandomProjection

public class Projection extends Object implements Transform
A projection is a kind of feature extraction technique that transforms data from the input space to a feature space, linearly or non-linearly. Often, projections are used to reduce dimensionality, for example PCA and random projection. However, kernel-based methods, e.g. Kernel PCA, can actually map the data into a much higher dimensional space.
See Also:
  • Field Details

    • projection

      public final Matrix projection
      The projection matrix. The dimension reduced data can be obtained by y = W * x.
    • schema

      public final StructType schema
      The schema of output space.
    • columns

      public final String[] columns
      The fields of input space.
  • Constructor Details

    • Projection

      public Projection(Matrix projection, String prefix, String... columns)
      Constructor.
      Parameters:
      projection - the projection matrix.
      prefix - the output field name prefix.
      columns - the input fields.
  • Method Details

    • apply

      public Tuple apply(Tuple x)
      Specified by:
      apply in interface Function<Tuple,Tuple>
    • apply

      public DataFrame apply(DataFrame data)
      Description copied from interface: Transform
      Applies this transform to the given argument.
      Specified by:
      apply in interface Transform
      Parameters:
      data - the input data frame.
      Returns:
      the transformed data frame.
    • apply

      public double[] apply(double[] x)
      Project a data point to the feature space.
      Parameters:
      x - the data point.
      Returns:
      the projection in the feature space.
    • apply

      public double[][] apply(double[][] x)
      Project a set of data to the feature space.
      Parameters:
      x - the data set.
      Returns:
      the projection in the feature space.
    • preprocess

      protected double[] preprocess(double[] x)
      Preprocess the input vector before projection.
      Parameters:
      x - the input vector of projection.
      Returns:
      the preprocessed vector.
    • postprocess

      protected double[] postprocess(double[] x)
      Postprocess the output vector after projection.
      Parameters:
      x - the output vector of projection.
      Returns:
      the postprocessed vector.