Package smile.feature.extraction
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
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
Modifier and TypeFieldDescriptionfinal String[]
The fields of input space.final Matrix
The projection matrix.final StructType
The schema of output space. -
Constructor Summary
ConstructorDescriptionProjection
(Matrix projection, String prefix, String... columns) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
apply
(double[] x) Project a data point to the feature space.double[][]
apply
(double[][] x) Project a set of data to the feature space.Applies this transform to the given argument.protected double[]
postprocess
(double[] x) Postprocess the output vector after projection.protected double[]
preprocess
(double[] x) Preprocess the input vector before projection.
-
Field Details
-
projection
The projection matrix. The dimension reduced data can be obtained by y = W * x. -
schema
The schema of output space. -
columns
The fields of input space.
-
-
Constructor Details
-
Projection
Constructor.- Parameters:
projection
- the projection matrix.prefix
- the output field name prefix.columns
- the input fields.
-
-
Method Details
-
apply
-
apply
Description copied from interface:Transform
Applies this transform to the given argument. -
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.
-