Reputation: 119
I am getting the following error, after trying to get most important variables with H2o Package in a classification binary problem with Rstudio.
Error in h(simpleError(msg, call)) : error in evaluating the argument 'object' in selecting a method for function 'h2o.varimp': no slot of name "leader" for this object of class "H2OBinomialModel"
Previous Error comes after applying the following steps.
# Lookup best Algorithm for this classification challenge (binary).
rautoml<- h2o.automl(y = target,x = independientes,
training_frame = train_h2o,
validation_frame = test_h2o, # Podría probar hacer el test contra el futuro.
nfolds = 3,
max_runtime_secs = 300,
sort_metric = 'AUC'
)
#Get the best model from previous step
rautoml_winner <- rautoml@leader
###### Winner model is a StackedEnsemble_AllModels####
#Get the most important variables.
h2o.varimp(rautoml_winner@leader)
And then last code produces this error.
Error in h(simpleError(msg, call)) : error in evaluating the argument 'object' in selecting a method for function 'h2o.varimp': no slot of name "leader" for this object of class "H2OBinomialModel"
Upvotes: 1
Views: 57
Reputation: 591
The h2o.varimp(rautoml_winner@leader)
makes no sense since the rautoml_winner
is already the leader model (= the best model according to the sort metric from the automl). Removing the @leader
would fix it for all models except for the Stacked Ensembles which do not have variable importance calculated during training.
You can still get variable importance for Stacked Ensembles using the permutation variable importance, e.g., h2o.permutation_importance(rautoml_winner, test_h2o)
. See the documentation for more information.
Upvotes: 1