tidymodels / agua

Create and evaluate models using 'tidymodels' and 'h2o'
https://agua.tidymodels.org
Other
21 stars 2 forks source link

case weights #22

Closed topepo closed 2 years ago

topepo commented 2 years ago

The h2o functions take weights in the argument weights_column that is described as "Column with observation weights".

topepo commented 2 years ago

The changes in h2o_train() would look something like

h2o_train <- function(x, y, weights = NULL, model, ...) { # new arg
  opts <- get_fit_opts(...)
  x <- as.data.frame(x)
  x_names <- names(x)
  x$.outcome <- y
  x$.weights <- weights  # new
  x <- as_h2o(x)$data

Then, since we named the new argument 'weights', the model function def just has to change

  protect = c("x", "y"),

to

  protect = c("x", "y", "weights"),
github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.