I am using h2o
automl library from python with scikit-learn wrapper to create a pipeline for training my model. I follow this example, recommended by the official documentation:
from sklearn import datasets
from sklearn.feature_selection import f_classif, SelectKBest
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import PolynomialFeatures
from h2o.sklearn import H2OAutoMLClassifier
X_classes_train, X_classes_test, y_classes_train, y_classes_test = train_test_split(X_classes, y_classes, test_size=0.33)
pipeline = Pipeline([
('polyfeat', PolynomialFeatures(degree=2)),
('featselect', SelectKBest(f_classif, k=5)),
('classifier', H2OAutoMLClassifier(max_models=10, seed=2022, sort_metric='logloss'))
])
pipeline.fit(X_classes_train, y_classes_train)
preds = pipeline.predict(X_classes_test)
So, I've trained my pipeline/model, now I want to get an H2OAutoML
object out of H2OAutoMLClassifier
wrapper to invoke .explain()
method on it and get some insight about the features and models.
How do I do that?