Skip to content

deprecate fit_control in favor of control_parsnip #618

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 7 commits into from
Dec 8, 2021
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
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@

* The fit time is only calculated when the `verbosity` argument of `control_parsnip()` is 2L or greater. Also, the call to `system.time()` now uses `gcFirst = FALSE`. (#611)

* `fit_control()` is soft-deprecated in favor of `control_parsnip()`.

* Argument `interval` was added for prediction: For types "survival" and "quantile", estimates for the confidence or prediction interval can be added if available (#615).


# parsnip 0.1.7

## Model Specification Changes
Expand Down
9 changes: 0 additions & 9 deletions R/control_parsnip.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,14 @@
#' @examples
#' control_parsnip(verbosity = 2L)
#'
#' @details
#' `fit_control()` is deprecated in favor of `control_parsnip()`.
#' @export
#'
control_parsnip <- function(verbosity = 1L, catch = FALSE) {
res <- list(verbosity = verbosity, catch = catch)
res <- check_control(res)
class(res) <- "control_parsnip"
res
}

#' @export
#' @rdname control_parsnip
fit_control <- function(verbosity = 1L, catch = FALSE) {
control_parsnip(verbosity = verbosity, catch = catch)
}

#' @export
print.control_parsnip <- function(x, ...) {
cat("parsnip control object\n")
Expand Down
32 changes: 32 additions & 0 deletions R/fit_control.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#' Control the fit function
#'
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' Pass options to the [fit.model_spec()] function to control its
#' output and computations
#'
#' @param verbosity An integer to control how verbose the output is. For a
#' value of zero, no messages or output are shown when packages are loaded or
#' when the model is fit. For a value of 1, package loading is quiet but model
#' fits can produce output to the screen (depending on if they contain their
#' own `verbose`-type argument). For a value of 2 or more, any output at all
#' is displayed and the execution time of the fit is recorded and printed.
#' @param catch A logical where a value of `TRUE` will evaluate the model
#' inside of `try(, silent = TRUE)`. If the model fails, an object is still
#' returned (without an error) that inherits the class "try-error".
#' @return An S3 object with class "control_parsnip" that is a named list
#' with the results of the function call
#'
#' @examples
#' fit_control(verbosity = 2L)
#'
#' @details
#' `fit_control()` is deprecated in favor of `control_parsnip()`.
#'
#' @export
#' @keywords internal
fit_control <- function(verbosity = 1L, catch = FALSE) {
lifecycle::deprecate_soft("0.1.8", "fit_control()", "control_parsnip()")
control_parsnip(verbosity = verbosity, catch = catch)
}
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ reference:
- extract-parsnip
- fit.model_spec
- fit_xy
- fit_control
- control_parsnip
- glance.model_fit
- model_fit
- model_spec
Expand Down
6 changes: 0 additions & 6 deletions man/control_parsnip.Rd

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

38 changes: 38 additions & 0 deletions man/fit_control.Rd

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