Skip to content

Commit eba71c4

Browse files
ehrlingerclaude
andauthored
varPro Phase 1: gg_partial_varpro — rename, deprecation shim, A+C survival paths (#84) (#84)
* chore: open v2.7.3.9002 dev cycle for varPro Phase 1 * feat: add gg_partial_varpro extractor (A-path, TDD) New extractor splits partialpro list output into continuous/categorical data frames with provenance attribute; C-path stub included for Task 6. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: extract .process_cat_var helper; add numeric/count tests * feat: promote varPro Suggests->Imports, add importFrom(varPro,partialpro) * fix: correct \tau Rd macro in gg_partial_varpro roxygen * feat: soft-deprecate gg_partialpro() -> gg_partial_varpro() shim * fix: gg_partialpro shim: add package=, expose full signature Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add plot.gg_partial_varpro with honest y-label; shim plot.gg_partialpro Implements plot.gg_partial_varpro for A-path objects (continuous line plots, categorical boxplots, scale-aware y-axis labels: mortality/rmst/surv/chf/generic). Replaces the full plot.gg_partialpro body in plot.gg_partial.R with a one-liner shim that re-dispatches to plot.gg_partial_varpro. All 35 gg_partial_varpro tests pass; gg_partialpro suite 31 pass / 3 skip (superseded plot tests). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: add complete @importFrom declarations to plot.gg_partial_varpro Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add autoplot/print/summary for gg_partial_varpro; shim old-class methods Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: autoplot.gg_partialpro should be a proper shim like print/summary * test: add C-path (scale=surv/chf) tests for gg_partial_varpro Three new tests exercise .gg_partial_varpro_cpath() with a real randomForestSRC survival fit on survival::veteran: class check, provenance path/scale, and plot() returning ggplot. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: extract make_mock_cpath() helper for C-path tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test: add vdiffr snapshots for plot.gg_partial_varpro Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: finalize NEWS, pkgdown, NAMESPACE for gg_partial_varpro - NEWS.md: replace Task 8 stub with full feature description - _pkgdown.yml: add gg_partial_varpro + plot.gg_partial_varpro before deprecated aliases in Partial Dependence reference section - R/gg_partial_varpro.R: extract .validate_varpro_inputs, .varpro_provenance, .build_varpro_dfs helpers to reduce cyclocomp from 25 to <20 (lintr cyclocomp_linter) - R/gg_partialpro.R: replace \lifecycle{deprecated} with plain \emph{Deprecated.} to remove unknown-macro Rd warning - R/plot.gg_partial_varpro.R: replace UTF-8 tau (τ) with τ to remove non-ASCII characters R CMD check warning - man/: regenerated by devtools::document(); plot.gg_partialpro.Rd removed (content merged into plot.gg_partial_varpro.Rd via @Rdname) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: correct @param time doc and Rd topic name for plot.gg_partial_varpro - @param time now accurately describes optional vs required behavior: required only for scale="rmst", optional for scale="surv"/"chf" with NULL falling back to three quartile time points via gg_partial_rfsrc() - Add @name plot.gg_partial_varpro to both the canonical function and the shim's @Rdname block so \name{} in the Rd is plot.gg_partial_varpro regardless of alphabetical processing order Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bd5ebbb commit eba71c4

25 files changed

Lines changed: 1583 additions & 425 deletions

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: ggRandomForests
22
Type: Package
33
Title: Visually Exploring Random Forests
4-
Version: 2.7.3.9001
5-
Date: 2026-05-19
4+
Version: 2.7.3.9002
5+
Date: 2026-05-20
66
Authors@R: person("John", "Ehrlinger",
77
role = c("aut", "cre"),
88
email = "john.ehrlinger@gmail.com")
@@ -22,6 +22,7 @@ Depends:
2222
Imports:
2323
randomForestSRC (>= 3.4.0),
2424
randomForest,
25+
varPro,
2526
survival,
2627
parallel,
2728
tidyr,
@@ -45,7 +46,6 @@ Suggests:
4546
knitr,
4647
plotly,
4748
igraph,
48-
callr,
49-
varPro
49+
callr
5050
VignetteBuilder: quarto
5151
Config/roxygen2/version: 8.0.0

NAMESPACE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ S3method(autoplot,gg_brier)
44
S3method(autoplot,gg_error)
55
S3method(autoplot,gg_partial)
66
S3method(autoplot,gg_partial_rfsrc)
7+
S3method(autoplot,gg_partial_varpro)
78
S3method(autoplot,gg_partialpro)
89
S3method(autoplot,gg_rfsrc)
910
S3method(autoplot,gg_roc)
@@ -31,6 +32,7 @@ S3method(plot,gg_brier)
3132
S3method(plot,gg_error)
3233
S3method(plot,gg_partial)
3334
S3method(plot,gg_partial_rfsrc)
35+
S3method(plot,gg_partial_varpro)
3436
S3method(plot,gg_partialpro)
3537
S3method(plot,gg_rfsrc)
3638
S3method(plot,gg_roc)
@@ -41,6 +43,7 @@ S3method(print,gg_brier)
4143
S3method(print,gg_error)
4244
S3method(print,gg_partial)
4345
S3method(print,gg_partial_rfsrc)
46+
S3method(print,gg_partial_varpro)
4447
S3method(print,gg_partialpro)
4548
S3method(print,gg_rfsrc)
4649
S3method(print,gg_roc)
@@ -52,6 +55,7 @@ S3method(summary,gg_brier)
5255
S3method(summary,gg_error)
5356
S3method(summary,gg_partial)
5457
S3method(summary,gg_partial_rfsrc)
58+
S3method(summary,gg_partial_varpro)
5559
S3method(summary,gg_partialpro)
5660
S3method(summary,gg_rfsrc)
5761
S3method(summary,gg_roc)
@@ -64,6 +68,7 @@ export(gg_brier)
6468
export(gg_error)
6569
export(gg_partial)
6670
export(gg_partial_rfsrc)
71+
export(gg_partial_varpro)
6772
export(gg_partialpro)
6873
export(gg_rfsrc)
6974
export(gg_roc)
@@ -82,6 +87,8 @@ importFrom(dplyr,select)
8287
importFrom(ggplot2,.data)
8388
importFrom(ggplot2,aes)
8489
importFrom(ggplot2,autoplot)
90+
importFrom(ggplot2,facet_wrap)
91+
importFrom(ggplot2,geom_boxplot)
8592
importFrom(ggplot2,geom_line)
8693
importFrom(ggplot2,geom_ribbon)
8794
importFrom(ggplot2,ggplot)
@@ -105,6 +112,8 @@ importFrom(stringr,str_sub)
105112
importFrom(survival,Surv)
106113
importFrom(survival,strata)
107114
importFrom(survival,survfit)
115+
importFrom(tidyr,all_of)
108116
importFrom(tidyr,pivot_longer)
109117
importFrom(utils,head)
110118
importFrom(utils,tail)
119+
importFrom(varPro,partialpro)

NEWS.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
Package: ggRandomForests
2-
Version: 2.7.3.9001
2+
Version: 2.7.3.9002
33

44
ggRandomForests v2.8.0 (development)
55
====================================
6+
* **varPro partial dependence: `gg_partial_varpro()` (#84).**
7+
- `gg_partial_varpro()` replaces `gg_partialpro()` as the primary entry
8+
point for varPro partial dependence plots. The new extractor accepts
9+
an optional `object` argument (the originating `varpro` fit) for
10+
provenance-aware axis labeling and a `scale` argument
11+
(`"auto"`, `"mortality"`, `"rmst"`, `"surv"`, `"chf"`).
12+
- **Ensemble mortality labeling** (Ishwaran et al. 2008): when
13+
`scale = "mortality"` (or `scale = "auto"` with a survival forest),
14+
the y-axis is labeled "Ensemble mortality (expected events)" — an
15+
unbounded relative-risk score, not a survival probability. The
16+
documentation explicitly warns against misinterpretation.
17+
- **Survival path C:** `scale = "surv"` or `scale = "chf"` extracts
18+
`object$rf` (the embedded rfsrc forest) and returns true S(t)/CHF
19+
partial curves via `gg_partial_rfsrc` infrastructure.
20+
- `varPro` is now a hard dependency (`Imports:`).
21+
- `gg_partialpro()` is soft-deprecated: it emits a deprecation warning
22+
and delegates to `gg_partial_varpro()`. Removal is planned for the
23+
release after v2.8.0.
624
* **randomForest engine validation & repair (#82).** Fixes #80, #81
725
and a `plot.gg_error` label wart; adds full randomForest regression
826
coverage. See sub-items below.

R/autoplot_methods.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ NULL
3434
#' \item{\code{gg_variable}}{Marginal dependence}
3535
#' \item{\code{gg_partial}}{Partial dependence (via \code{plot.variable})}
3636
#' \item{\code{gg_partial_rfsrc}}{Partial dependence (via \code{partial.rfsrc})}
37-
#' \item{\code{gg_partialpro}}{Partial dependence (via \code{varPro})}
37+
#' \item{\code{gg_partial_varpro}}{Partial dependence (via \code{varPro})}
38+
#' \item{\code{gg_partialpro}}{Partial dependence via \code{varPro} (deprecated alias)}
3839
#' \item{\code{gg_roc}}{ROC curve}
3940
#' \item{\code{gg_survival}}{Survival / cumulative hazard curves}
4041
#' \item{\code{gg_brier}}{Time-resolved Brier score and CRPS}
@@ -93,6 +94,14 @@ autoplot.gg_partial_rfsrc <- function(object, ...) {
9394
#' @rdname autoplot.gg
9495
#' @export
9596
autoplot.gg_partialpro <- function(object, ...) {
97+
## Deprecated-class shim: re-dispatch to autoplot.gg_partial_varpro.
98+
class(object) <- c("gg_partial_varpro", setdiff(class(object), "gg_partialpro"))
99+
autoplot.gg_partial_varpro(object, ...)
100+
}
101+
102+
#' @rdname autoplot.gg
103+
#' @export
104+
autoplot.gg_partial_varpro <- function(object, ...) {
96105
plot(object, ...)
97106
}
98107

0 commit comments

Comments
 (0)