Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for h2o package #8

Closed
bgreenwell opened this issue Nov 21, 2017 · 1 comment
Closed

Add support for h2o package #8

bgreenwell opened this issue Nov 21, 2017 · 1 comment
Labels

Comments

@bgreenwell
Copy link
Member

@bgreenwell bgreenwell commented Nov 21, 2017

Some support for regression models is there, but it needs to be tested! Also, h2o.varimp() output is model specific!

@bgreenwell bgreenwell changed the title Add support for h2O models Add support for h2o models Jun 11, 2018
@bgreenwell
Copy link
Member Author

@bgreenwell bgreenwell commented Jun 11, 2018

Here is what h2o is doing internally (will need to check for NULL):

#'
#' Retrieve the variable importance.
#'
#' @param object An \linkS4class{H2OModel} object.
#' @export
h2o.varimp <- function(object) {
  o <- object
  if( is(o, "H2OModel") ) {
    vi <- o@model$variable_importances
    if( is.null(vi) ) { vi <- object@model$standardized_coefficient_magnitudes }  # no true variable importances, maybe glm coeffs? (return standardized table...)
    if( is.null(vi) ) {
      warning("This model doesn't have variable importances", call. = FALSE)
      return(invisible(NULL))
    }
    vi
  } else {
    warning( paste0("No variable importances for ", class(o)) )
    return(NULL)
  }
}
@bgreenwell bgreenwell changed the title Add support for h2o models Add support for h2o package Jun 14, 2018
@bgreenwell bgreenwell closed this Jun 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.