Class Projection

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

public class Projection extends Object implements smile.data.transform.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 Summary

    Fields
    Modifier and Type
    Field
    Description
    final String[]
    The fields of input space.
    final smile.math.matrix.Matrix
    The projection matrix.
    final smile.data.type.StructType
    The schema of output space.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Projection(smile.math.matrix.Matrix projection, String prefix, String... columns)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    apply(double[] x)
    Project a data point to the feature space.
    double[][]
    apply(double[][] x)
    Project a set of data to the feature space.
    smile.data.DataFrame
    apply(smile.data.DataFrame data)
     
    smile.data.Tuple
    apply(smile.data.Tuple x)
     
    protected double[]
    postprocess(double[] x)
    Postprocess the output vector after projection.
    protected double[]
    preprocess(double[] x)
    Preprocess the input vector before projection.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Function

    andThen, compose

    Methods inherited from interface smile.data.transform.Transform

    andThen, compose
  • Field Details

    • projection

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

      public final smile.data.type.StructType schema
      The schema of output space.
    • columns

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

    • Projection

      public Projection(smile.math.matrix.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 smile.data.Tuple apply(smile.data.Tuple x)
      Specified by:
      apply in interface Function<smile.data.Tuple,smile.data.Tuple>
    • apply

      public smile.data.DataFrame apply(smile.data.DataFrame data)
      Specified by:
      apply in interface smile.data.transform.Transform
    • 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.