autoprognosis.plugins.prediction.classifiers.plugin_hist_gradient_boosting module

class HistGradientBoostingPlugin(learning_rate: float = 0.1, max_depth: int = 6, calibration: int = 0, model: Any | None = None, random_state: int = 0, **kwargs: Any)

Bases: ClassifierPlugin

Classification plugin based on the Histogram-based Gradient Boosting Classification Tree.

Method:

This estimator is much faster than GradientBoostingClassifier for big datasets (n_samples >= 10 000).

Parameters:
  • learning_rate – float Learning rate shrinks the contribution of each tree by learning_rate. There is a trade-off between learning_rate and n_estimators.

  • max_depth

    int

    The maximum depth of the individual regression estimators.

    calibration: int

    Enable/disable calibration. 0: disabled, 1 : sigmoid, 2: isotonic.

    random_state: int, default 0

    Random seed

Example

>>> from autoprognosis.plugins.prediction import Predictions
>>> plugin = Predictions(category="classifiers").get("hist_gradient_boosting")
>>> from sklearn.datasets import load_iris
>>> X, y = load_iris(return_X_y=True)
>>> plugin.fit_predict(X, y) # returns the probabilities for each class
change_output(output: str) None
explain(X: DataFrame, *args: Any, **kwargs: Any) DataFrame
fit(X: DataFrame, *args: Any, **kwargs: Any) Plugin

Train the plugin

Parameters:

X – pd.DataFrame

fit_predict(X: DataFrame, *args: Any, **kwargs: Any) DataFrame

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

fit_transform(X: DataFrame, *args: Any, **kwargs: Any) 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

get_args() dict
static hyperparameter_space(*args: Any, **kwargs: Any) List[Params]

The hyperparameter search domain, used for tuning.

classmethod hyperparameter_space_fqdn(*args: Any, **kwargs: Any) List[Params]

The hyperparameter domain using they fully-qualified name.

is_fitted() bool

Check if the model was trained

classmethod load(buff: bytes) HistGradientBoostingPlugin

Load the plugin from bytes

static name() str

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

predict(X: DataFrame, *args: Any, **kwargs: Any) DataFrame

Run predictions for the input. Used by predictors.

Parameters:

X – pd.DataFrame

predict_proba(X: DataFrame, *args: Any, **kwargs: Any) 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

score(X: DataFrame, y: DataFrame, metric: str = 'aucroc') float
static subtype() str

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

transform(X: DataFrame) 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 HistGradientBoostingPlugin