fix: rc7 review findings across the 4.0.0 RC series - #302
Conversation
- 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>
|
R CMD check --as-cran on a clean |
There was a problem hiding this comment.
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
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.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
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>


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 inR/), on one branch so rc7 includes them all.gg_vimp.rfsrc()nvarkept 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 overallallcolumn first. The randomForest method already did this. This bug is also on CRAN (3.5.x)..varpro_rank_of()x1borrowx10's rank. It now applies only to names that aren't themselves columns of the feature matrix.gg_auct.rhf()methodis recorded (attr(, "method")) and named on the y axis ("Cumulative/dynamic AUC(t)" / "Incident/dynamic AUC(t)"). Amethodthat contradicts a suppliedauct_fitnow warns instead of being dropped.gg_ale_rfsrc()categoricalgg_ale_rfsrc()efficiencypredict()call per variable or surface. A default 25 × 25 interaction surface used to make up to 2,500. Continuous and interaction values are identical tomain, checked withidentical()on the airquality fixture.plot.gg_partial_varpro()typedraws the two level curves only;causalmust 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.DESCRIPTIONDateupdated 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:
gg-partial-varpro-*baselines lose only the causal series (fewer shapes, no causal legend text);gg-auct-chfchanges only its y-axis label.No other baseline changed, and
mainhadn't moved since branching.Verification
document(),lint_package(): 0 lintsNOT_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.nvarkeeps the top 2;x1doesn't borrowx10's rank;gg_auctwarns on a method mismatch and records the method;predict()call.R CMD check --as-cranon a clean export of this branch: running, and I'll post the result here.🤖 Generated with Claude Code