Skip to content

fix: rc7 review findings across the 4.0.0 RC series - #302

Merged
ehrlinger merged 2 commits into
mainfrom
fix/rc7-review
Sep 29, 2026
Merged

ehrlinger merged 2 commits into
mainfrom
fix/rc7-review

Conversation

@ehrlinger

Copy link
Copy Markdown
Owner

What

These are fixes for the seven findings from a rollup review of v4.0.0-rc1..main (239 commits, about 2,300 added lines in R/), on one branch so rc7 includes them all.

# Where Fix
1 gg_vimp.rfsrc() Multi-class nvar kept the least important variables. The importance matrix is in predictor order and was trimmed before it was sorted: gg_vimp(rf, nvar = 2) on iris returned Sepal.Length and Sepal.Width. It now ranks by the overall all column first. The randomForest method already did this. This bug is also on CRAN (3.5.x).
2 .varpro_rank_of() The digit-suffix fallback for expanded factors let a real column x1 borrow x10's rank. It now applies only to names that aren't themselves columns of the feature matrix.
3 gg_auct.rhf() method is recorded (attr(, "method")) and named on the y axis ("Cumulative/dynamic AUC(t)" / "Incident/dynamic AUC(t)"). A method that contradicts a supplied auct_fit now warns instead of being dropped.
4 gg_ale_rfsrc() categorical Each level-to-level step now averages over the observations at both adjacent levels (Apley & Zhu; ALEPlot), not just the upper level.
5 gg_ale_rfsrc() efficiency Continuous, categorical and interaction ALE now make one predict() call per variable or surface. A default 25 × 25 interaction surface used to make up to 2,500. Continuous and interaction values are identical to main, checked with identical() on the airquality fixture.
6 plot.gg_partial_varpro() The default type draws the two level curves only; causal must be asked for. It's a contrast that starts at zero, and on a regression it squeezed the level curves into a thin band. The varpro vignette now asks for all three explicitly. This changes the default on CRAN.
7 DESCRIPTION Date updated for the next RC (it was 2026-08-31).

NEWS has new bullets for 1 and 6, the two changes CRAN users will see. For 3 and 4 the existing v4 bullets are amended, since both features are new in v4. Item 2 is internal.

Baselines

Five were regenerated, and I checked each diff:

  • four gg-partial-varpro-* baselines lose only the causal series (fewer shapes, no causal legend text);
  • gg-auct-chf changes only its y-axis label.

No other baseline changed, and main hadn't moved since branching.

Verification

  • document(), lint_package(): 0 lints
  • NOT_CRAN=true VDIFFR_RUN_TESTS=true devtools::test(): FAIL 0 | SKIP 6 | PASS 2212. The skips are pre-existing and deliberate, and no snapshot files were deleted.
  • New tests, each seen failing before its fix:
    • rfsrc multi-class nvar keeps the top 2;
    • x1 doesn't borrow x10's rank;
    • gg_auct warns on a method mismatch and records the method;
    • categorical ALE steps equal the two-level means;
    • ALE makes one predict() call.
  • R CMD check --as-cran on a clean export of this branch: running, and I'll post the result here.

🤖 Generated with Claude Code

- gg_vimp.rfsrc(nvar = ): rank a multi-class importance matrix by its
  overall column before trimming. It arrived in predictor order, so
  nvar = 2 on iris returned the two least important variables.
- .varpro_rank_of(): the digit-suffix fallback for expanded factors now
  applies only to names absent from the feature matrix, so x1 cannot
  borrow x10's rank.
- gg_auct.rhf(): record the AUC method (attr "method"), name it on the
  plot's y axis, and warn when method contradicts a supplied auct_fit
  instead of dropping it.
- gg_ale_rfsrc(): categorical steps average over the observations at both
  adjacent levels (Apley and Zhu; ALEPlot), not the upper level alone.
  Continuous, categorical and interaction ALE now predict once per
  variable or surface; continuous and interaction values are identical
  to before.
- plot.gg_partial_varpro(): default type draws the two level curves;
  causal is opt-in. The varpro vignette asks for all three explicitly.
- DESCRIPTION Date for the next RC.

Baselines regenerated (5): four gg_partial_varpro plots lose the causal
series, gg-auct-chf gains the "Cumulative/dynamic" y label. No others
changed; main had not moved since branching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 18:58
@ehrlinger

Copy link
Copy Markdown
Owner Author

R CMD check --as-cran on a clean git archive export of ca708931, with the PDF manual: Status: OK (0 errors, 0 warnings, 0 notes). Timings: examples 14s, examples with --run-donttest 35s, tests 21s, vignette rebuild 47s. That is down from 60s on main; the explainability vignette runs gg_ale_rfsrc() live, so the batching may account for some of it, but one run on each side is not a controlled measurement.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

ALE aggregation can replace occupied-group NA predictions with zero, and the new AUC method attribute remains undocumented.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Addresses seven v4.0.0 release-candidate review findings across importance ranking, ALE computation, AUC metadata, and partial-varpro plotting.

Changes:

  • Corrects VIMP and categorical ALE calculations while reducing ALE prediction calls.
  • Records and labels AUC methods and changes partial-varpro plot defaults.
  • Updates tests, snapshots, documentation, NEWS, and release date.
File Description
DESCRIPTION Updates release date.
NEWS.md Documents user-visible fixes.
R/​gg_ale_rfsrc.R Corrects and batches ALE calculations.
R/​gg_auct.R Records AUC method and warns on conflicts.
R/​gg_vimp.R Ranks multiclass VIMP before trimming.
R/​plot.gg_auct.R Adds method-specific axis labels.
R/​plot.gg_partial_varpro.R Excludes causal curves by default.
R/​utils.R Tightens expanded-factor rank matching.
man/​plot.gg_partial_varpro.Rd Updates generated plot documentation.
tests/​testthat/​test_gg_ale_rfsrc.R Tests ALE correctness and batching.
tests/​testthat/​test_gg_auct.R Tests AUC method handling.
tests/​testthat/​test_gg_vimp.R Tests multiclass top-variable selection.
tests/​testthat/​test_plot_gg_auct.R Updates axis-label expectation.
tests/​testthat/​test_varpro_importance_order.R Tests digit-suffix rank isolation.
tests/​testthat/​_snaps/​snapshots/​gg-auct-chf.svg Updates AUC label baseline.
tests/​testthat/​_snaps/​snapshots/​gg-partial-varpro-both.svg Updates two-panel default baseline.
tests/​testthat/​_snaps/​snapshots/​gg-partial-varpro-categorical.svg Updates categorical baseline.
tests/​testthat/​_snaps/​snapshots/​gg-partial-varpro-continuous.svg Updates continuous baseline.
tests/​testthat/​_snaps/​snapshots/​gg-partial-varpro-mortality.svg Updates mortality baseline.
vignettes/​varpro.qmd Explicitly requests all three estimators.
Files not reviewed (1)
  • man/plot.gg_partial_varpro.Rd: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread R/gg_ale_rfsrc.R
Comment thread R/gg_auct.R
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.88%. Comparing base (c042902) to head (e1f44b0).

Files with missing lines Patch % Lines
R/plot.gg_auct.R 80.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #302      +/-   ##
==========================================
+ Coverage   90.85%   90.88%   +0.02%     
==========================================
  Files          60       60              
  Lines        5875     5882       +7     
==========================================
+ Hits         5338     5346       +8     
+ Misses        537      536       -1     
Files with missing lines Coverage Δ
R/gg_ale_rfsrc.R 96.17% <100.00%> (+0.82%) ⬆️
R/gg_auct.R 95.00% <100.00%> (+1.06%) ⬆️
R/gg_vimp.R 88.50% <100.00%> (+0.05%) ⬆️
R/plot.gg_partial_varpro.R 92.64% <100.00%> (+0.03%) ⬆️
R/utils.R 98.27% <100.00%> (ø)
R/plot.gg_auct.R 93.54% <80.00%> (-2.75%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot review on #302:

- .ale_group_mean() zeroed every NA mean, so an occupied bin with an NA
  prediction read as a flat step. Zero only empty groups; the per-bin loop
  this replaced propagated the NA.
- gg_auct() @return now lists the method attribute.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ehrlinger
ehrlinger merged commit d217eb0 into main Sep 29, 2026
10 checks passed
@ehrlinger
ehrlinger deleted the fix/rc7-review branch September 29, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants