autoprognosis.plugins.preprocessors.feature_scaling.plugin_normal_transform module

class NormalTransformPlugin(random_state: int = 0, n_quantiles: int = 100, model: Optional[Any] = None)

Bases: autoprognosis.plugins.preprocessors.base.PreprocessorPlugin

Preprocessing plugin for feature scaling based on quantile information.

Method:

This method transforms the features to follow a normal distribution. Therefore, for a given feature, this transformation tends to spread out the most frequent values.

Reference:

https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.QuantileTransformer.html

Example

>>> from autoprognosis.plugins.preprocessors import Preprocessors
>>> plugin = Preprocessors().get("normal_transform")
>>> from sklearn.datasets import load_iris
>>> X, y = load_iris(return_X_y=True)
>>> plugin.fit_transform(X, y)
            0         1         2         3
0   -0.701131  1.061219 -1.205040 -1.138208
1   -1.154434 -0.084214 -1.205040 -1.138208
2   -1.523968  0.443066 -1.674870 -1.138208
3   -1.710095  0.229099 -0.836836 -1.138208
4   -0.923581  1.222611 -1.205040 -1.138208
..        ...       ...       ...       ...
145  1.017901 -0.084214  0.778555  1.523968
146  0.509020 -1.297001  0.547708  0.813193
147  0.778555 -0.084214  0.778555  0.949666
148  0.378986  0.824957  0.869109  1.523968
149  0.109568 -0.084214  0.669219  0.627699

[150 rows x 4 columns]

change_output(output: str) None
static components_interval(*args: Any, **kwargs: Any) Tuple[int, int]
fit(X: pandas.core.frame.DataFrame, *args: Any, **kwargs: Any) autoprognosis.plugins.core.base_plugin.Plugin

Train the plugin

Parameters

X – pd.DataFrame

fit_predict(X: pandas.core.frame.DataFrame, *args: Any, **kwargs: Any) pandas.core.frame.DataFrame

Fit the model and predict the training data. Used by predictors.

fit_transform(X: pandas.core.frame.DataFrame, *args: Any, **kwargs: Any) pandas.core.frame.DataFrame

Fit the model and transform the training data. Used by imputers and preprocessors.

classmethod fqdn() str

The fully-qualified name of the plugin: type->subtype->name

static hyperparameter_space(*args: Any, **kwargs: Any) List[autoprognosis.plugins.core.params.Params]

The hyperparameter search domain, used for tuning.

classmethod hyperparameter_space_fqdn(*args: Any, **kwargs: Any) List[autoprognosis.plugins.core.params.Params]

The hyperparameter domain using they fully-qualified name.

is_fitted() bool

Check if the model was trained

classmethod load(buff: bytes) autoprognosis.plugins.preprocessors.feature_scaling.plugin_normal_transform.NormalTransformPlugin

Load the plugin from bytes

static name() str

The name of the plugin, e.g.: xgboost

predict(X: pandas.core.frame.DataFrame, *args: Any, **kwargs: Any) pandas.core.frame.DataFrame

Run predictions for the input. Used by predictors.

Parameters

X – pd.DataFrame

classmethod sample_hyperparameters(trial: optuna.trial.Trial, *args: Any, **kwargs: Any) Dict[str, Any]

Sample hyperparameters for Optuna.

classmethod sample_hyperparameters_fqdn(trial: optuna.trial.Trial, *args: Any, **kwargs: Any) Dict[str, Any]

Sample hyperparameters using they fully-qualified name.

classmethod sample_hyperparameters_np(random_state: int = 0, *args: Any, **kwargs: Any) Dict[str, Any]

Sample hyperparameters as a dict.

save() bytes

Save the plugin to bytes

static subtype() str

The type of the plugin, e.g.: classifier

transform(X: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame

Transform the input. Used by imputers and preprocessors.

Parameters

X – pd.DataFrame

static type() str

The type of the plugin, e.g.: prediction

plugin

alias of autoprognosis.plugins.preprocessors.feature_scaling.plugin_normal_transform.NormalTransformPlugin