OneHotEncoder
OneHotEncoder(columns=None, numerical=[])
This transformer applies One-Hot-Encoder to features.
Attributes
numerical: pandas [n_columns]. numerical columns to be treated as categorical. columns: pandas [n_columns]. columns to use (if None then all categorical variables are included).
Examples
For usage examples, please see: https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/OneHotEncoder/
Methods
fit(X, y=None, fit_params)
Selecting OneHotEncoder columns from the dataset.
Parameters
-
X
: {Dataframe}, shape = [n_samples, n_features]Dataframe, where n_samples is the number of samples and n_features is the number of features.
Returns
self
fit_transform(X, y=None, fit_params)
Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
Parameters
-
X
: numpy array of shape [n_samples, n_features]Training set.
-
y
: numpy array of shape [n_samples]Target values.
Returns
-
X_new
: numpy array of shape [n_samples, n_features_new]Transformed array.
get_params(deep=True)
Get parameters for this estimator.
Parameters
-
deep
: boolean, optionalIf True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns
-
params
: mapping of string to anyParameter names mapped to their values.
set_params(params)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it's possible to update each
component of a nested object.
Returns
self
transform(X)
Trransformer applies log to skewed features.
Parameters
-
X
: {Dataframe}, shape = [n_samples, n_features]Dataframe of samples, where n_samples is the number of samples and n_features is the number of features.
Returns
-
X_transform
: {DAtaframe}, shape = [n_samples, n_features]A copy of the input Dataframe with the columns encoder.