Collect candidate parameters and stacking coefficientsSource:
A function to help situate candidates within a stack. Takes in a data stack or model stack and candidate name and returns a tibble mapping the candidate/member names to their hyperparameters (and, if a model stack, to their stacking coefficients as well).
collect_parameters(stack, candidates, ...) # S3 method for default collect_parameters(stack, candidates, ...) # S3 method for data_stack collect_parameters(stack, candidates, ...) # S3 method for model_stack collect_parameters(stack, candidates, ...)
The name of the candidates to collect parameters on. This will either be the
nameargument supplied to
add_candidates()or, if not supplied, the name of the object supplied to the
Additional arguments. Currently ignored.
A tibble::tbl_df with information on member names and hyperparameters.
This package provides some resampling objects and datasets for use in examples and vignettes derived from a study on 1212 red-eyed tree frog embryos!
Red-eyed tree frog (RETF) embryos can hatch earlier than their normal 7ish days if they detect potential predator threat. Researchers wanted to determine how, and when, these tree frog embryos were able to detect stimulus from their environment. To do so, they subjected the embryos at varying developmental stages to "predator stimulus" by jiggling the embryos with a blunt probe. Beforehand, though some of the embryos were treated with gentamicin, a compound that knocks out their lateral line (a sensory organ.) Researcher Julie Jung and her crew found that these factors inform whether an embryo hatches prematurely or not!
Note that the data included with the stacks package is not necessarily a representative or unbiased subset of the complete dataset, and is only for demonstrative purposes.
rset cross-fold validation objects
rsample, splitting the training data into for the regression
and classification model objects, respectively.
tree_frogs_class_test are the analogous testing sets.
reg_res_sp contain regression tuning results
for a linear regression, support vector machine, and spline model, respectively,
latency (i.e. how long the embryos took to hatch in response
to the jiggle) in the
tree_frogs data, using most all of the other
variables as predictors. Note that the data underlying these models is
filtered to include data only from embryos that hatched in response to
class_res_nn contain multiclass classification tuning
results for a random forest and neural network classification model,
reflex (a measure of ear function) in the
data using most all of the other variables as predictors.
log_res_nn, contain binary classification tuning results
for a random forest and neural network classification model, respectively,
hatched (whether or not the embryos hatched in response
to the stimulus) using most all of the other variables as predictors.
?example_data to learn more about these objects, as well as browse
the source code that generated them.
# see the "Example Data" section above for # clarification on the objects used in these examples! # put together a data stack using # tuning results for regression models reg_st <- stacks() %>% add_candidates(reg_res_lr) %>% add_candidates(reg_res_svm) %>% add_candidates(reg_res_sp, "spline") reg_st #> # A data stack with 3 model definitions and 16 candidate members: #> # reg_res_lr: 1 model configuration #> # reg_res_svm: 5 model configurations #> # spline: 10 model configurations #> # Outcome: latency (numeric) # check out the hyperparameters for some of the candidates collect_parameters(reg_st, "reg_res_svm") #> # A tibble: 5 × 3 #> member cost rbf_sigma #> <chr> <dbl> <dbl> #> 1 reg_res_svm_1_1 3.09 0.000000465 #> 2 reg_res_svm_1_2 9.56 0.00346 #> 3 reg_res_svm_1_3 0.321 0.0256 #> 4 reg_res_svm_1_4 0.00486 0.00000251 #> 5 reg_res_svm_1_5 0.0146 0.00000000959 collect_parameters(reg_st, "spline") #> # A tibble: 10 × 2 #> member age #> <chr> <int> #> 1 spline_01_1 12 #> 2 spline_02_1 6 #> 3 spline_03_1 15 #> 4 spline_04_1 5 #> 5 spline_05_1 3 #> 6 spline_06_1 13 #> 7 spline_07_1 9 #> 8 spline_08_1 10 #> 9 spline_09_1 7 #> 10 spline_10_1 2 # blend the data stack to view the hyperparameters # along with the stacking coefficients! collect_parameters( reg_st %>% blend_predictions(), "spline" ) #> # A tibble: 10 × 3 #> member age coef #> <chr> <int> <dbl> #> 1 spline_01_1 12 0 #> 2 spline_02_1 6 0 #> 3 spline_03_1 15 0.486 #> 4 spline_04_1 5 0 #> 5 spline_05_1 3 0 #> 6 spline_06_1 13 0 #> 7 spline_07_1 9 0 #> 8 spline_08_1 10 0 #> 9 spline_09_1 7 0 #> 10 spline_10_1 2 0.0482