Package smile.feature.extraction
Class SparseEncoder
java.lang.Object
smile.feature.extraction.SparseEncoder
- All Implemented Interfaces:
Function<smile.data.Tuple,
smile.util.SparseArray>
public class SparseEncoder
extends Object
implements Function<smile.data.Tuple,smile.util.SparseArray>
Encodes numeric and categorical features into sparse array
with on-hot encoding of categorical variables.
-
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
public smile.util.SparseArray apply(smile.data.Tuple x) Generates the sparse representation of given object. -
apply
public smile.util.SparseArray[] apply(smile.data.DataFrame data) Generates the sparse representation of a data frame.- Parameters:
data
- a data frame.- Returns:
- the sparse feature vectors.
-