Skip to content
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
7 changes: 7 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ jobs:
extra-packages: any::rcmdcheck
needs: check

## Due to the RSPM setting opemp improperly circa 2026-06-30
- name: Install gower from source (macOS only)
if: runner.os == 'macOS'
run: |
install.packages("gower", type = "source")
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# probably (development version)

* Fixed `cal_plot_breaks()`, `cal_plot_logistic()`, and `cal_plot_windowed()` so that plots of tuning results with more than one model configuration can be rendered. The grouping column was dropped before the plot was faceted (#202).

# probably 1.2.0

* Add `required_pkgs()` methods to `int_conformal_cv()`, `int_conformal_full()`, `int_conformal_quantile()`, and `int_conformal_split()`. (#190)
Expand Down
2 changes: 1 addition & 1 deletion R/cal-plot-breaks.R
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ cal_plot_breaks_impl <- function(
.data = .data,
truth = !!truth,
estimate = !!estimate,
group = !!group,
.by = !!group,
num_breaks = num_breaks,
conf_level = conf_level,
event_level = event_level
Expand Down
2 changes: 1 addition & 1 deletion R/cal-plot-logistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ cal_plot_logistic_impl <- function(
.data = .data,
truth = !!truth,
estimate = !!estimate,
group = !!group,
.by = !!group,
conf_level = conf_level,
event_level = event_level,
smooth = smooth
Expand Down
2 changes: 1 addition & 1 deletion R/cal-plot-windowed.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ cal_plot_windowed_impl <- function(
.data = .data,
truth = !!truth,
estimate = !!estimate,
group = !!group,
.by = !!group,
window_size = window_size,
step_size = step_size,
conf_level = conf_level,
Expand Down
50 changes: 35 additions & 15 deletions tests/testthat/_snaps/cal-plot-regression.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@
$slope
[1] "slope"

$colour
[1] "colour"

$fill
[1] "fill"
attr(,"fallback")
[1] TRUE

$colour
[1] "colour"
attr(,"fallback")
[1] TRUE

$alt
[1] ""
Expand Down Expand Up @@ -54,11 +58,15 @@
$slope
[1] "slope"

$colour
[1] "colour"

$fill
[1] "fill"
attr(,"fallback")
[1] TRUE

$colour
[1] "colour"
attr(,"fallback")
[1] TRUE

$alt
[1] ""
Expand Down Expand Up @@ -87,11 +95,15 @@
$slope
[1] "slope"

$colour
[1] "colour"

$fill
[1] "fill"
attr(,"fallback")
[1] TRUE

$colour
[1] "colour"
attr(,"fallback")
[1] TRUE

$alt
[1] ""
Expand Down Expand Up @@ -120,11 +132,15 @@
$slope
[1] "slope"

$colour
[1] "colour"

$fill
[1] "fill"
attr(,"fallback")
[1] TRUE

$colour
[1] "colour"
attr(,"fallback")
[1] TRUE

$alt
[1] ""
Expand Down Expand Up @@ -153,11 +169,15 @@
$slope
[1] "slope"

$colour
[1] "colour"

$fill
[1] "fill"
attr(,"fallback")
[1] TRUE

$colour
[1] "colour"
attr(,"fallback")
[1] TRUE

$alt
[1] ""
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-cal-plot-breaks.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ test_that("don't facet if there is only one .config", {
expect_s3_class(res_breaks, "ggplot")
})

test_that("tune_results plot can be built - facet variable is in the data (#202)", {
res_breaks <- cal_plot_breaks(testthat_cal_binary())

expect_true(".config" %in% names(res_breaks$data))
expect_no_error(ggplot2::ggplot_build(res_breaks))
})

test_that("custom names for cal_plot_breaks()", {
data(segment_logistic)
segment_logistic_1 <- dplyr::rename(segment_logistic, good_prob = .pred_good)
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-cal-plot-logistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ test_that("don't facet if there is only one .config", {
expect_s3_class(res_logistic, "ggplot")
})

test_that("tune_results plot can be built - facet variable is in the data (#202)", {
res_logistic <- cal_plot_logistic(testthat_cal_binary())

expect_true(".config" %in% names(res_logistic$data))
expect_no_error(ggplot2::ggplot_build(res_logistic))
})


test_that("Groups are respected", {
preds <- segment_logistic |>
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-cal-plot-windowed.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ test_that("don't facet if there is only one .config", {
expect_s3_class(res_windowed, "ggplot")
})

test_that("tune_results plot can be built - facet variable is in the data (#202)", {
res_windowed <- cal_plot_windowed(testthat_cal_binary())

expect_true(".config" %in% names(res_windowed$data))
expect_no_error(ggplot2::ggplot_build(res_windowed))
})


test_that("Groupings that may not match work", {
model <- glm(Class ~ .pred_good, segment_logistic, family = "binomial")
Expand Down
Loading