Get Parameters from Models - tidymodels

Is there a function to extract the parameters and suggested parameter ranges from a specification:

m_spec <-
boost_tree() %>%
set_engine("xgboost") %>%
set_mode("classification")

I am building a shiny application and would like to know the arguments which are available to populate based on the dynamically selected model type and engine which may vary depending on user selection. It seems like all the tune grid functions require knowledge of parameters prior, in other words I have to build a table of parameter mappings by method and manage this in my application.

My expectation of m_spec is to get a list of parameters - eta, lambda, nrounds, etc. with suggested ranges. Then when I change to rf I get mtry, etc. These would just be data in a tibble. Further I would like to get other model specific information prior like acceptable importance values by model i.e. "impurity".

show_model_info("boost_tree") gives me what I want but how do I get this into a vector data frame?

arguments:
xgboost:
tree_depth --> max_depth
trees --> nrounds
learn_rate --> eta
mtry --> colsample_bynode
min_n --> min_child_weight
loss_reduction --> gamma
sample_size --> subsample
stop_iter --> early_stop
C5.0:
trees --> trials
min_n --> minCases
sample_size --> sample
spark:
tree_depth --> max_depth
trees --> max_iter
learn_rate --> step_size
mtry --> feature_subset_strategy
min_n --> min_instances_per_node
loss_reduction --> min_info_gain
sample_size --> subsampling_rate

show_models_info appends '_args' to the model type name and calls a function that returns a table with the parameters.

parsnip::get_from_env("boost_tree_args")

thank you, this works.

is there also a similar method to get the engine specific arguments? For example, I would like to know what the acceptable values are for the importance argument for each engine.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.