ml_grid.model_classes.H2OAutoMLClassifier

Classes

H2OAutoMLClassifier

Initializes the H2OAutoMLClassifier.

Module Contents

class ml_grid.model_classes.H2OAutoMLClassifier.H2OAutoMLClassifier(max_runtime_secs: int = 360, nfolds: int = 2, seed: int = 1)[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.ClassifierMixin

Initializes the H2OAutoMLClassifier.

Parameters:
  • max_runtime_secs (int) – Maximum time in seconds to run the AutoML process.

  • nfolds (int) – Number of folds for cross-validation.

  • seed (int) – Random seed for reproducibility.

max_runtime_secs = 360[source]
nfolds = 2[source]
seed = 1[source]
automl: h2o.automl.H2OAutoML | None = None[source]
classes_: numpy.ndarray | None = None[source]
fit(X: pandas.DataFrame, y: pandas.Series) H2OAutoMLClassifier[source]

Fits the H2O AutoML model.

This method initializes an H2O cluster, converts the pandas DataFrame and Series to H2O Frames, and then trains the AutoML model.

Parameters:
  • X (pd.DataFrame) – The training input samples.

  • y (pd.Series) – The target values.

Returns:

The fitted estimator.

Return type:

H2OAutoMLClassifier

predict(X: pandas.DataFrame) numpy.ndarray[source]

Predicts class labels for samples in X.

Parameters:

X (pd.DataFrame) – The input samples to predict.

Returns:

The predicted class labels.

Return type:

np.ndarray

abstract predict_proba(X: pandas.DataFrame) numpy.ndarray[source]

Predicts class probabilities for samples in X.

Note

This method is not implemented for H2O AutoML.

Parameters:

X (pd.DataFrame) – The input samples.

Raises:

NotImplementedError – H2O AutoML does not support predict_proba.

get_params(deep: bool = True) Dict[str, Any][source]

Gets parameters for this estimator.

Parameters:

deep (bool) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

Parameter names mapped to their values.

Return type:

Dict[str, Any]

set_params(**params: Any) H2OAutoMLClassifier[source]

Sets the parameters of this estimator.

Parameters:

**params (Any) – Estimator parameters.

Returns:

The instance with updated parameters.

Return type:

H2OAutoMLClassifier

get_leader_params() Dict[str, Any][source]

Gets the parameters of the best model found by AutoML.

Returns:

A dictionary of the leader model’s parameters.

Return type:

Dict[str, Any]