Skip to content

Tables for engine specific params in model docs #272

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

Merged
merged 2 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Imports:
prettyunits,
vctrs (>= 0.2.0)
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.0.2.9000
RoxygenNote: 7.1.0
Suggests:
testthat,
knitr,
Expand Down
27 changes: 25 additions & 2 deletions R/aaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,29 @@ convert_stan_interval <- function(x, level = 0.95, lower = TRUE) {
res
}

convert_args <- function(model_name) {
envir <- get_model_env()

args <-
ls(envir) %>%
tibble::tibble(name = .) %>%
dplyr::filter(grepl("args", name)) %>%
dplyr::mutate(model = sub("_args", "", name),
args = purrr::map(name, ~envir[[.x]])) %>%
tidyr::unnest(args) %>%
dplyr::select(model:original)

convert_df <- args %>%
dplyr::filter(grepl(model_name, model)) %>%
dplyr::select(-model) %>%
tidyr::pivot_wider(names_from = engine, values_from = original)

convert_df %>%
knitr::kable(col.names = paste0("**", colnames(convert_df), "**"))

}


# ------------------------------------------------------------------------------
# nocov

Expand All @@ -32,8 +55,8 @@ utils::globalVariables(
c('.', '.label', '.pred', '.row', 'data', 'engine', 'engine2', 'group',
'lab', 'original', 'predicted_label', 'prediction', 'value', 'type',
"neighbors", ".submodels", "has_submodel", "max_neighbor", "max_penalty",
"max_terms", "max_tree", "name", "num_terms", "penalty", "trees",
"max_terms", "max_tree", "model", "name", "num_terms", "penalty", "trees",
"sub_neighbors", ".pred_class")
)
)

# nocov end
7 changes: 7 additions & 0 deletions R/boost_tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("boost_tree")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of model, the template of the
#' fit calls are:
Expand Down
7 changes: 7 additions & 0 deletions R/decision_tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("decision_tree")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are::
Expand Down
7 changes: 7 additions & 0 deletions R/linear_reg.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("linear_reg")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are:
Expand Down
7 changes: 7 additions & 0 deletions R/logistic_reg.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("logistic_reg")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are:
Expand Down
7 changes: 7 additions & 0 deletions R/mars.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("mars")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are:
Expand Down
7 changes: 7 additions & 0 deletions R/mlp.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("mlp")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are:
Expand Down
7 changes: 7 additions & 0 deletions R/multinom_reg.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("multinom_reg")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are:
Expand Down
7 changes: 7 additions & 0 deletions R/nearest_neighbor.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("nearest_neighbor")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are:
Expand Down
7 changes: 7 additions & 0 deletions R/rand_forest.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("rand_forest")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are::
Expand Down
7 changes: 7 additions & 0 deletions R/surv_reg.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("surv_reg")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are:
Expand Down
7 changes: 7 additions & 0 deletions R/svm_poly.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("svm_poly")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are::
Expand Down
7 changes: 7 additions & 0 deletions R/svm_rbf.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
#'
#' @section Engine Details:
#'
#' The standardized parameter names in parsnip can be mapped to their original
#' names in each engine:
#'
#' ```{r echo = FALSE}
#' convert_args("svm_rbf")
#' ```
#'
#' Engines may have pre-set default arguments when executing the
#' model fit call. For this type of
#' model, the template of the fit calls are::
Expand Down
14 changes: 14 additions & 0 deletions man/boost_tree.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions man/decision_tree.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/linear_reg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/logistic_reg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions man/mars.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions man/mlp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/multinom_reg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions man/nearest_neighbor.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions man/rand_forest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions man/surv_reg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions man/svm_poly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading