Package smile.feature.extraction
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
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
FieldsModifier and TypeFieldDescriptionfinal 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
ConstructorsConstructorDescriptionProjection
(smile.math.matrix.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.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 smile.data.transform.Transform
andThen, compose
-
Field Details
-
projection
public final smile.math.matrix.Matrix projectionThe projection matrix. The dimension reduced data can be obtained by y = W * x. -
schema
public final smile.data.type.StructType schemaThe 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
public smile.data.Tuple apply(smile.data.Tuple x) -
apply
public smile.data.DataFrame apply(smile.data.DataFrame data) - Specified by:
apply
in interfacesmile.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.
-