replace_nullable_types#
Transformer to replace features with the new nullable dtypes with a dtype that is compatible in EvalML.
Module Contents#
Classes Summary#
Transformer to replace features with the new nullable dtypes with a dtype that is compatible in EvalML. |
Contents#
- class evalml.pipelines.components.transformers.preprocessing.replace_nullable_types.ReplaceNullableTypes(random_seed=0, **kwargs)[source]#
Transformer to replace features with the new nullable dtypes with a dtype that is compatible in EvalML.
Attributes
hyperparameter_ranges
None
modifies_features
True
modifies_target
{}
name
Replace Nullable Types Transformer
training_only
False
Methods
Constructs a new component with the same parameters and random state.
Returns the default parameters for this component.
Describe a component and its parameters.
Fits component to data.
Substitutes non-nullable types for the new pandas nullable types in the data and target data.
Loads component at file path.
Returns boolean determining if component needs fitting before calling predict, predict_proba, transform, or feature_importances.
Returns the parameters which were used to initialize the component.
Saves component at file path.
Transforms data by replacing columns that contain nullable types with the appropriate replacement type.
Updates the parameter dictionary of the component.
- clone(self)#
Constructs a new component with the same parameters and random state.
- Returns
A new instance of this component with identical parameters and random state.
- default_parameters(cls)#
Returns the default parameters for this component.
Our convention is that Component.default_parameters == Component().parameters.
- Returns
Default parameters for this component.
- Return type
dict
- describe(self, print_name=False, return_dict=False)#
Describe a component and its parameters.
- Parameters
print_name (bool, optional) – whether to print name of component
return_dict (bool, optional) – whether to return description as dictionary in the format {“name”: name, “parameters”: parameters}
- Returns
Returns dictionary if return_dict is True, else None.
- Return type
None or dict
- fit(self, X, y=None)[source]#
Fits component to data.
- Parameters
X (pd.DataFrame) – The input training data of shape [n_samples, n_features].
y (pd.Series, optional) – The target training data of length [n_samples].
- Returns
self
- fit_transform(self, X, y=None)[source]#
Substitutes non-nullable types for the new pandas nullable types in the data and target data.
- Parameters
X (pd.DataFrame, optional) – Input features.
y (pd.Series) – Target data.
- Returns
The input features and target data with the non-nullable types set.
- Return type
tuple of pd.DataFrame, pd.Series
- static load(file_path)#
Loads component at file path.
- Parameters
file_path (str) – Location to load file.
- Returns
ComponentBase object
- needs_fitting(self)#
Returns boolean determining if component needs fitting before calling predict, predict_proba, transform, or feature_importances.
This can be overridden to False for components that do not need to be fit or whose fit methods do nothing.
- Returns
True.
- property parameters(self)#
Returns the parameters which were used to initialize the component.
- save(self, file_path, pickle_protocol=cloudpickle.DEFAULT_PROTOCOL)#
Saves component at file path.
- Parameters
file_path (str) – Location to save file.
pickle_protocol (int) – The pickle data stream format.
- transform(self, X, y=None)[source]#
Transforms data by replacing columns that contain nullable types with the appropriate replacement type.
“float64” for nullable integers and “category” for nullable booleans.
- Parameters
X (pd.DataFrame) – Data to transform
y (pd.Series, optional) – Target data to transform
- Returns
Transformed X pd.Series: Transformed y
- Return type
pd.DataFrame
- update_parameters(self, update_dict, reset_fit=True)#
Updates the parameter dictionary of the component.
- Parameters
update_dict (dict) – A dict of parameters to update.
reset_fit (bool, optional) – If True, will set _is_fitted to False.