tidymodels / tidymodels/workflows
Consider recipe's `skip` with calibration
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 211
- Forks
- 26
- Avg merge
- 1h 58m
- Merged PRs (30d)
- 1
Description
If we set skip = FALSE, it breaks.
If skip = TRUE, we might want to do something a little less subtle than the NA in the print output.
library(workflows)
library(recipes)
#> Loading required package: dplyr
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#>
#> Attaching package: 'recipes'
#> The following object is masked from 'package:stats':
#>
#> step
library(parsnip)
library(tailor)
dat <- modeldata::sim_classification(1000)
rec_skip_false <- recipe(class ~ ., data = dat) |>
step_filter(non_linear_1 > 0, skip = FALSE)
tlr_cal <- tailor() |>
adjust_probability_calibration(method = "logistic")
workflow(rec_skip_false, logistic_reg(), tlr_cal) |>
fit(data = dat, data_calibration = dat)
#> Error in `vctrs::vec_cbind()`:
#> ! Can't recycle `..1` (size 502) to match `..2` (size 1000).
rec_skip_true <- recipe(class ~ ., data = dat) |>
step_filter(non_linear_1 > 0, skip = TRUE)
workflow(rec_skip_true, logistic_reg(), tlr_cal) |>
fit(data = dat, data_calibration = dat)
#> Registered S3 method overwritten by 'butcher':
#> method from
#> as.character.dev_topic generics
#> ══ Workflow [trained] ══════════════════════════════════════════════════════════
#> Preprocessor: Recipe
#> Model: logistic_reg()
#> Postprocessor: tailor
#>
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> 1 Recipe Step
#>
#> • step_filter()
#>
#> ── Model ───────────────────────────────────────────────────────────────────────
#>
#> Call: stats::glm(formula = ..y ~ ., family = stats::binomial, data = data)
#>
#> Coefficients:
#> (Intercept) two_factor_1 two_factor_2 non_linear_1 non_linear_2
#> 0.27458 2.48406 -2.42843 0.69884 -1.48342
#> non_linear_3 linear_01 linear_02 linear_03 linear_04
#> 0.39114 -0.21790 -0.09806 -0.09972 0.09155
#> linear_05 linear_06 linear_07 linear_08 linear_09
#> 0.02849 0.11098 -0.14325 0.01839 -0.24682
#> linear_10
#> -0.19332
#>
#> Degrees of Freedom: 501 Total (i.e. Null); 486 Residual
#> Null Deviance: 695
#> Residual Deviance: 366.9 AIC: 398.9
#>
#> ── Postprocessor ───────────────────────────────────────────────────────────────
#>
#> ── tailor ──────────────────────────────────────────────────────────────────────
#> A binary postprocessor with 1 adjustment:
#>
#> • Re-calibrate classification probabilities using logistic method.
#> NA
#> NA
#> NA
Created on 2026-03-20 with reprex v2.1.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two examples using workflows, recipes, parsnip, and tailor, focusing on workflow() with fit(), step_filter(), and adjust_probability_calibration(). Trace how calibration handles the rows removed when skip is FALSE and how the trained workflow is printed when skip is TRUE. Done means the reported behavior is resolved without the size mismatch or unexplained NA output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100