From 6a012a692ff91adbbd4eb14366f61b3f9aead3b1 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Thu, 17 Sep 2026 09:21:04 -0500 Subject: [PATCH 1/4] check CI runs clean From 2d62b194ca7c943e4aabb329adc79735547b599c Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Thu, 17 Sep 2026 09:46:28 -0500 Subject: [PATCH 2/4] Add testthat snapshot variant for xgboost 3.2.1.1 CI runners now install xgboost 3.2.1.1, which had no snapshot variant in test-discretize_xgb.R, causing all snapshot-based tests in that file to fail as "new snapshot" warnings-turned-errors. --- .../testthat/_snaps/3.2.1.1/discretize_xgb.md | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 tests/testthat/_snaps/3.2.1.1/discretize_xgb.md diff --git a/tests/testthat/_snaps/3.2.1.1/discretize_xgb.md b/tests/testthat/_snaps/3.2.1.1/discretize_xgb.md new file mode 100644 index 0000000..7b9eb75 --- /dev/null +++ b/tests/testthat/_snaps/3.2.1.1/discretize_xgb.md @@ -0,0 +1,208 @@ +# run_xgboost for classification + + Code + xgboost + Output + ##### xgb.Booster + call: + xgboost::xgb.train(params = .params, data = .train, nrounds = 100, + evals = list(train = .train, test = .test), verbose = 0, + early_stopping_rounds = 10) + # of features: 13 + # of rounds: 80 + xgb.attributes: + best_iteration, best_score + callbacks: + early_stop, evaluation_log + evaluation_log: + iter train_logloss test_logloss + + 1 0.5739956 0.5763535 + 2 0.5546428 0.5563444 + --- --- --- + 79 0.4189363 0.4445886 + 80 0.4186880 0.4440128 + +# run_xgboost for multi-classification + + Code + xgboost + Output + ##### xgb.Booster + call: + xgboost::xgb.train(params = .params, data = .train, nrounds = 100, + evals = list(train = .train, test = .test), verbose = 0, + early_stopping_rounds = 10) + # of features: 30 + # of rounds: 31 + xgb.attributes: + best_iteration, best_score + callbacks: + early_stop, evaluation_log + evaluation_log: + iter train_mlogloss test_mlogloss + + 1 1.363338 1.377775 + 2 1.331378 1.352738 + --- --- --- + 30 1.160942 1.255252 + 31 1.159259 1.256760 + +# run_xgboost for regression + + Code + xgboost + Output + ##### xgb.Booster + call: + xgboost::xgb.train(params = .params, data = .train, nrounds = 100, + evals = list(train = .train, test = .test), verbose = 0, + early_stopping_rounds = 10) + # of features: 73 + # of rounds: 25 + xgb.attributes: + best_iteration, best_score + callbacks: + early_stop, evaluation_log + evaluation_log: + iter train_rmse test_rmse + + 1 0.15708398 0.1633305 + 2 0.14190657 0.1588983 + --- --- --- + 24 0.07039493 0.1211529 + 25 0.06975907 0.1206107 + +# xgb_binning for classification + + Code + xgb_binning + Output + [1] 1 2 3 5 6 9 12 15 20 + +# xgb_binning for multi-classification + + Code + xgb_binning + Output + [1] 26 + +# xgb_binning for regression + + Code + xgb_binning + Output + [1] 42.01972 42.02510 42.03122 42.03462 42.03840 42.04638 42.05236 42.05917 + +# step_discretize_xgb for classification + + Code + xgb_train_bins[1:10, ] + Output + # A tibble: 10 x 3 + x z class + + 1 [0.6808, Inf] [0.3327, Inf] a + 2 [0.5749,0.6808) [0.3327, Inf] b + 3 [0.3687,0.5749) [-Inf,0.3327) b + 4 [0.5749,0.6808) [0.3327, Inf] b + 5 [0.6808, Inf] [0.3327, Inf] a + 6 [0.5749,0.6808) [0.3327, Inf] a + 7 [0.5749,0.6808) [-Inf,0.3327) b + 8 [0.5749,0.6808) [-Inf,0.3327) a + 9 [0.2779,0.3687) [0.3327, Inf] a + 10 [0.3687,0.5749) [0.3327, Inf] b + +--- + + Code + xgb_test_bins[1:10, ] + Output + # A tibble: 10 x 3 + x z class + + 1 [0.5749,0.6808) [-Inf,0.3327) b + 2 [0.5749,0.6808) [0.3327, Inf] b + 3 [0.3687,0.5749) [-Inf,0.3327) b + 4 [0.2779,0.3687) [0.3327, Inf] b + 5 [0.6808, Inf] [0.3327, Inf] a + 6 [0.3687,0.5749) [-Inf,0.3327) b + 7 [0.2779,0.3687) [0.3327, Inf] a + 8 [0.6808, Inf] [0.3327, Inf] a + 9 [0.3687,0.5749) [0.3327, Inf] b + 10 [0.3687,0.5749) [0.3327, Inf] b + +--- + + Code + prep(step_discretize_xgb(recipe(class ~ ., data = sim_tr_cls[1:9, ]), + all_predictors(), outcome = "class")) + Condition + Error in `step_discretize_xgb()`: + Caused by error in `prep()`: + ! Too few observations in the early stopping validation set. + i Consider increasing the `sample_val` parameter. + +--- + + Code + set.seed(1) + prep(step_discretize_xgb(recipe(Status ~ ., data = credit_data_train), Time, + outcome = "Status"), retain = TRUE) + Condition + Warning: + More than 20 unique training set values are required. + i Predictors 'Time' were not processed; their original values will be used. + Message + + -- Recipe ---------------------------------------------------------------------- + + -- Inputs + Number of variables by role + outcome: 1 + predictor: 13 + + -- Training information + Training data contained 3340 data points and 301 incomplete rows. + + -- Operations + * Discretizing variables using xgboost: | Trained + +# step_discretize_xgb for multi-classification + + Code + xgb_train_bins[1:10, ] + Output + # A tibble: 10 x 3 + x z class + + 1 [0.6879, Inf] [0.09924, Inf] c + 2 [0.5863,0.6879) [0.09924, Inf] b + 3 [0.3821,0.5863) [-Inf,0.09924) b + 4 [0.5863,0.6879) [0.09924, Inf] b + 5 [0.6879, Inf] [0.09924, Inf] c + 6 [0.5863,0.6879) [0.09924, Inf] c + 7 [0.5863,0.6879) [-Inf,0.09924) b + 8 [0.5863,0.6879) [0.09924, Inf] c + 9 [-Inf,0.2887) [0.09924, Inf] a + 10 [0.3821,0.5863) [0.09924, Inf] b + +--- + + Code + xgb_test_bins[1:10, ] + Output + # A tibble: 10 x 3 + x z class + + 1 [0.5863,0.6879) [0.09924, Inf] b + 2 [0.5863,0.6879) [0.09924, Inf] b + 3 [0.3821,0.5863) [0.09924, Inf] b + 4 [0.2887,0.3821) [0.09924, Inf] b + 5 [0.6879, Inf] [0.09924, Inf] c + 6 [0.3821,0.5863) [-Inf,0.09924) b + 7 [0.2887,0.3821) [0.09924, Inf] a + 8 [0.6879, Inf] [0.09924, Inf] c + 9 [0.3821,0.5863) [0.09924, Inf] b + 10 [0.3821,0.5863) [0.09924, Inf] b + From 60a5dd5b61231b4fb5b398b671e5fb0f21bfbe44 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Thu, 17 Sep 2026 10:19:13 -0500 Subject: [PATCH 3/4] Use CRAN macOS binaries instead of P3M to avoid gower OpenMP issue P3M's macOS binaries are built with OpenMP enabled, but the GitHub Actions runners have no libomp, so gower (and similar packages) fail to load with "symbol not found ... ___kmpc_barrier". CRAN's own macOS binaries are built without OpenMP, so use those instead. --- .github/workflows/R-CMD-check.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index d0bc82c..e29cd54 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -49,7 +49,10 @@ jobs: with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} - use-public-rspm: true +# P3M's macOS binaries are built with OpenMP enabled, but the runners + # have no libomp, so e.g. gower fails to load. CRAN's own macOS + # binaries are built without it, so use those instead. + use-public-rspm: ${{ matrix.config.os != 'macos-latest' }} - uses: r-lib/actions/setup-r-dependencies@v2 with: From e0bf04280e4656e661533e0b57505081acae0e05 Mon Sep 17 00:00:00 2001 From: Emil Hvitfeldt Date: Thu, 17 Sep 2026 10:20:36 -0500 Subject: [PATCH 4/4] Fix indentation of comment in R-CMD-check.yaml --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index e29cd54..0a137d5 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -49,7 +49,7 @@ jobs: with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} -# P3M's macOS binaries are built with OpenMP enabled, but the runners + # P3M's macOS binaries are built with OpenMP enabled, but the runners # have no libomp, so e.g. gower fails to load. CRAN's own macOS # binaries are built without it, so use those instead. use-public-rspm: ${{ matrix.config.os != 'macos-latest' }}