简体   繁体   中英

Error with H2O: "no slot of name "leader"

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"

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, eg, h2o.permutation_importance(rautoml_winner, test_h2o) . See the documentation for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM