Skip to content

gg_varpro(): intermittent failure on survival fits — varPro importance() returns 0 rows #118

@ehrlinger

Description

@ehrlinger

Symptom

gg_varpro() on a survival varPro::varpro() fit can fail with:

Error: arguments imply differing number of rows: <p>, 0

(e.g. differing number of rows: 12, 0). This is real and not rare on real survival data, even though it does not reproduce on every fit (e.g. pbc across ntree = 50..200 happened to land on the working path during triage). gg_varpro() survival support otherwise works (the varpro vignette renders gg_varpro(v_pbc)), so this is an intermittent failure, not a categorical limitation.

Likely root cause

The cbind/data.frame in the importance reshape (.build_varpro_imp_dfs() → it combines the p variable names with the rows returned by varPro::importance()) gets a 0-row importance table for the failing survival fits. So varPro::importance() is returning an empty result for those survival fits — likely a varPro-side condition (no rules/variables survive the importance pre-filter, or a survival-specific code path).

Tasks (later / dev line)

  1. Find the varPro condition. Build a reproducer (a survival fit where varPro::importance(fit) returns 0 rows), isolate what triggers it, and file upstream with varPro (Lu/Ishwaran) if it's a varPro bug.
  2. Protect against it in ggRandomForests. Detect the empty-importance case in .build_varpro_imp_dfs() / gg_varpro() and fail gracefully with a clear, specific message (or a sensible fallback) — scoped to the 0-row case, NOT a blanket survival family block. A family block was tried in fix(gg_varpro): clear error on survival fits instead of cryptic cbind #116 and was wrong: it breaks the working survival path and the vignette render (fix(gg_varpro): clear error on survival fits instead of cryptic cbind #116 closed).

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions