-
Notifications
You must be signed in to change notification settings - Fork 90
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
Simpler stacking of model specs or workflows without considering metrics #685
Comments
I have two quick comments:
|
|
Hopefully you can get it working! At a first glance I don't think we will implement this feature since it is trying to deal with a problem that eventually will be fixed once {censored} becomes mature enough and get full support from the other core packages. |
Yeah I still fail at check metrics, would probably involve change the check_metrics function on tune and creating a censored metric on yardstick? library(tidymodels)
#> Warning: package 'tidymodels' was built under R version 4.1.3
#> Registered S3 method overwritten by 'tune':
#> method from
#> required_pkgs.model_spec parsnip
#> Warning: package 'broom' was built under R version 4.1.3
#> Warning: package 'dials' was built under R version 4.1.3
#> Warning: package 'dplyr' was built under R version 4.1.3
#> Warning: package 'infer' was built under R version 4.1.3
#> Warning: package 'modeldata' was built under R version 4.1.3
#> Warning: package 'parsnip' was built under R version 4.1.3
#> Warning: package 'recipes' was built under R version 4.1.3
#> Warning: package 'rsample' was built under R version 4.1.3
#> Warning: package 'tidyr' was built under R version 4.1.3
#> Warning: package 'tune' was built under R version 4.1.3
#> Warning: package 'workflows' was built under R version 4.1.3
#> Warning: package 'yardstick' was built under R version 4.1.3
library(censored)
#> Carregando pacotes exigidos: survival
#> Warning: package 'survival' was built under R version 4.1.3
library(stacks)
#> Warning: package 'stacks' was built under R version 4.1.3
ph_spec <-
proportional_hazards() %>%
set_engine("survival") %>%
set_mode("censored regression")
ph_workflow <- workflow() %>%
add_variables(outcomes = c(time, status),
predictors = everything()) %>%
add_model(ph_spec, formula = Surv(time, status) ~ .)
ph_workflow |> tune_grid(resamples = vfold_cv(lung))
#> Error in `check_metrics()`:
#> ! Unknown `mode` for parsnip model. Created on 2022-03-17 by the reprex package (v2.0.1) |
Closing in favor of tidymodels/stacks#199 and tidymodels/stacks#152. tidymodels/stacks#199 and a model specification from the bespoke extension package would do the trick for you, I think. Depending on your application, modeltime.ensemble could be another helpful tool. |
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. |
I don't know the best way to do it but the basic idea would be to define a set of model specs as a named list and define a final spec as the model that would combine all the predictions.
Then there would exist this function which would receive the list of base specs and the finalizing model
And this final model would be the 'spec' responsible for keeping track of the fits of all base models, so you could add this spec to a workflow or just a simple model fit
simple_stack |> fit(Sale_Price ~. ,ames_train)
This simpler approach to stacking would be specially nice to 'embed' sparse variable spaces with complex models and get regularized predictions with simpler models as the final_component, it may be better to force the components to be all workflows, but that would make it impossible to work with censored... Or we could add recipes for survival data as well to solve that problem, I am very open to help with pr's but I don't know if you guys like the idea or how to best implement it.
The text was updated successfully, but these errors were encountered: