Repository navigation
renew cached objects for testing #775
Copy link
Copy link
Closed
Description
Scales 1.3.0 made a change in the object class of its transformers. Their new class ("transformers") is not compatible with the old class (see below). We need to recreate these with the new version of scales.
library(tidymodels)
library(testthat)
#>
#> Attaching package: 'testthat'
#> The following object is masked from 'package:tidyr':
#>
#> matches
#> The following object is masked from 'package:rsample':
#>
#> matches
#> The following object is masked from 'package:purrr':
#>
#> is_null
#> The following object is masked from 'package:dplyr':
#>
#> matches
library(scales)tidymodels_prefer()
theme_set(theme_bw())
options(pillar.advice = FALSE, pillar.min_title_chars = Inf)# uses old format transformers (pre scales v 1.3.0)
# Get current cached test object
temp_loc <- tempfile()
download.file(
"https://github.com/tidymodels/tune/raw/main/tests/testthat/data/svm_reg_results.rds",
temp_loc)
svm_reg_results <- readRDS(temp_loc)
autoplot(svm_reg_results)
#> Error in `as.trans()`:
#> ! `trans` must be a character vector or a transformer object
#> Backtrace:
#> ▆
#> 1. ├─ggplot2::autoplot(svm_reg_results)
#> 2. └─tune:::autoplot.tune_results(svm_reg_results)
#> 3. └─tune:::plot_regular_grid(...) at tune/R/plots.R:106:11
#> 4. └─ggplot2::scale_x_continuous(trans = trans) at tune/R/plots.R:634:5
#> 5. └─ggplot2::continuous_scale(...)
#> 6. └─scales::as.trans(trans)
#> 7. └─cli::cli_abort(...)
#> 8. └─rlang::abort(...)
# The dials objects are in the pre-made parameter sets
dials_params <- tune:::get_param_object(svm_reg_results)
dials_params
#> Collection of 3 parameters for tuning
#>
#> identifier type object
#> cost cost nparam[+]
#> %^*# degree nparam[+]
#> scale_factor scale_factor nparam[+]
scale_trans_obj <- dials_params$object[[3]]$trans
# with new scales:
class(scale_trans_obj)
#> [1] "trans"
is.trans(scale_trans_obj)
#> [1] FALSE
as.trans(scale_trans_obj)
#> Error in `as.trans()`:
#> ! `scale_trans_obj` must be a character vector or a transformer object
#> Backtrace:
#> ▆
#> 1. └─scales::as.trans(scale_trans_obj)
#> 2. └─cli::cli_abort(...)
#> 3. └─rlang::abort(...)Created on 2023-12-02 with reprex v2.0.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
New dials objects for #775 (#776)
Remake with newest CRAN version of scales for #775
Refactored functions to select single evaluation times (#778)
Refactored functions to evaluate/check metric and eval time arguments (…
simonpcouch commentedon Jan 26, 2024
Closed by #776🚀
github-actions commentedon Feb 10, 2024
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.