Explain the behavior of a model or group of models with respect to a single row of data. The function returns a list of explanations, which are individual units of explanation such as a partial dependence plot or a variable importance plot. Most of the explanations are visual (ggplot plots). These plots can also be created by individual utility functions as well.
h2o.explain_row( object, newdata, row_index, columns = NULL, top_n_features = 5, include_explanations = "ALL", exclude_explanations = NULL, plot_overrides = NULL )
object | One of the following: an H2O model, a list of H2O models, an H2OAutoML object or an H2OAutoML Leaderboard slice. |
---|---|
newdata | An H2OFrame. |
row_index | A row index of the instance to explain. |
columns | A vector of column names or column indices to create plots with. If specified parameter top_n_features will be ignored. |
top_n_features | An integer specifying the number of columns to use, ranked by variable importance (where applicable). |
include_explanations | If specified, return only the specified model explanations. (Mutually exclusive with exclude_explanations) |
exclude_explanations | Exclude specified model explanations. |
plot_overrides | Overrides for individual model explanations, e.g.,
|
List of outputs with class "H2OExplanation"
# NOT RUN { library(h2o) h2o.init() # Import the wine dataset into H2O: f <- "https://h2o-public-test-data.s3.amazonaws.com/smalldata/wine/winequality-redwhite-no-BOM.csv" df <- h2o.importFile(f) # Set the response response <- "quality" # Split the dataset into a train and test set: splits <- h2o.splitFrame(df, ratios = 0.8, seed = 1) train <- splits[[1]] test <- splits[[2]] # Build and train the model: aml <- h2o.automl(y = response, training_frame = train, max_models = 10, seed = 1) # Create the explanation for whole H2OAutoML object exa <- h2o.explain_row(aml, test, row_index = 1) print(exa) # Create the explanation for the leader model exm <- h2o.explain_row(aml@leader, test, row_index = 1) print(exm) # }