Skip to content
Open
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
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Authors@R: c(
Description: The ability to tune models is important. 'tune' contains
functions and classes to be used in conjunction with other
'tidymodels' packages for finding reasonable values of
hyper-parameters in models, preprocessing methods, and
post-processing steps.
hyper-parameters in models, preprocessing methods, and post-processing
steps.
License: MIT + file LICENSE
URL: https://tune.tidymodels.org/, https://github.com/tidymodels/tune
BugReports: https://github.com/tidymodels/tune/issues
Expand All @@ -21,11 +21,12 @@ Imports:
cli (>= 3.3.0),
dials (>= 1.3.0.9000),
dplyr (>= 1.1.0),
GauPro (>= 0.2.15),
generics (>= 0.1.2),
ggplot2,
glue (>= 1.6.2),
GauPro (>= 0.2.15),
hardhat (>= 1.4.2),
lifecycle,
parallel,
parsnip (>= 1.4.1.9002),
purrr (>= 1.0.0),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# tune (development version)

* `check_metrics()` is deprecated in favor of `check_metrics_arg()` (#1160).

* Model tuning has been enabled for quantile regression models. (#1125)

* In `tune_grid()`, a bug was fixed that caused inefficiency where preprocessing steps were applied to data being predicted several times (redundantly). We now execute that operation once. (#1101)
Expand Down
6 changes: 5 additions & 1 deletion R/checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,12 @@ check_extra_tune_parameters <- function(x) {
#' @export
#' @keywords internal
#' @rdname empty_ellipses
#' @param object A `workflow` object.
#' @param object
#' `r lifecycle::badge("deprecated")`
#'
#' A `workflow` object.
check_metrics <- function(x, object) {
lifecycle::deprecate_warn("2.1.0", "check_metrics()", "check_metrics_arg()")
mode <- extract_spec_parsnip(object)$mode

if (is.null(x)) {
Expand Down
4 changes: 3 additions & 1 deletion man/empty_ellipses.Rd

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

9 changes: 9 additions & 0 deletions tests/testthat/_snaps/checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@
Error in `tune:::check_metrics()`:
! The parsnip model has `mode = 'classification'`, but `metrics` is a metric set for a different model mode.

# check_metrics() is deprecated

Code
metric <- check_metrics(NULL, wflow)
Condition
Warning:
`check_metrics()` was deprecated in tune 2.1.0.
i Please use `check_metrics_arg()` instead.

# grid control objects

Code
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ test_that("workflow objects (will not tune, tidymodels/tune#548)", {

test_that("yardstick objects", {
skip_if_not_installed("splines2")
withr::local_options(lifecycle_verbosity = "quiet")

spline_rec <-
recipes::recipe(ridership ~ ., data = head(Chicago)) |>
Expand Down Expand Up @@ -326,6 +327,7 @@ test_that("yardstick objects", {
})

test_that("metrics must match the parsnip engine", {
withr::local_options(lifecycle_verbosity = "quiet")
metric_set1 <- yardstick::metric_set(yardstick::accuracy)
metric_set2 <- yardstick::metric_set(yardstick::rmse)

Expand All @@ -344,6 +346,12 @@ test_that("metrics must match the parsnip engine", {
})
})

test_that("check_metrics() is deprecated", {
mod <- parsnip::rand_forest(mode = "regression")
wflow <- add_model(workflow(), mod)
expect_snapshot(metric <- check_metrics(NULL, wflow))
})

# ------------------------------------------------------------------------------

test_that("grid control objects", {
Expand Down
Loading