Package smile.feature.extraction
Class SparseEncoder
java.lang.Object
smile.feature.extraction.SparseEncoder
- All Implemented Interfaces:
Function<Tuple,
SparseArray>
Encodes numeric and categorical features into sparse array
with on-hot encoding of categorical variables.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGenerates the sparse representation of a data frame.Generates the sparse representation of given object.
-
Constructor Details
-
SparseEncoder
Constructor.- Parameters:
schema
- the data frame schema.columns
- the column names of variables to encode. If empty, all numeric and categorical columns will be used.
-
-
Method Details
-
apply
Generates the sparse representation of given object.- Specified by:
apply
in interfaceFunction<Tuple,
SparseArray> - Parameters:
x
- an object of interest.- Returns:
- the sparse feature vector.
-
apply
Generates the sparse representation of a data frame.- Parameters:
data
- a data frame.- Returns:
- the sparse feature vectors.
-