Skip to content

14/ prepareData: clear error for a missing or empty outcome (results unchanged) - #138

Draft
ellispatrick wants to merge 1 commit into
review/9-coxnet-pathfrom
review/14-crossvalidate-null-outcome
Draft

ellispatrick wants to merge 1 commit into
review/9-coxnet-pathfrom
review/14-crossvalidate-null-outcome

Conversation

@ellispatrick

Copy link
Copy Markdown
Member

Follow-up to the stack (#126 → #134 → this). Based on #134. It can be accepted or rejected on its own.

Summary

Results unchanged. prepareData, which crossValidate calls for matrix and DataFrame input, now stops with "'outcome' is missing or empty" when the outcome is NULL or has length 0.

Why

  • An outcome of NULL, for example from outcomes[[name]] with a name the list doesn't have, used to pass every check.
  • Each fold then failed inside feature selection, and crossValidate stopped with: "All cross-validations had an error. The common problem is: argument 1 is not a vector". That message doesn't point to the cause.
  • This was hit with the protocol's own PROMAD data (Procedure 4). Its outcome list is named Counts_<cohort>_Biopsy_ABMR.csv, while its measurement list is named <cohort>, so looking up the outcome by cohort name returned NULL.

What changes

  • A check at the start of the prepareData DataFrame method, which the matrix and data.frame methods also reach.
  • A test of prepareData and crossValidate with a NULL outcome, a missing outcome and an empty factor.

Evidence

548 test expectations pass (test_branch.sh).

🤖 Generated with Claude Code

https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4

Why: an outcome of NULL (e.g. from outcomes[[name]] with a name the list doesn't have) passed every check,
and each fold then failed inside feature selection, so crossValidate stopped with "All cross-validations
had an error. The common problem is: argument 1 is not a vector", which doesn't point to the cause.
Found with the protocol's PROMAD data, whose outcome list is named Counts_<cohort>_Biopsy_ABMR.csv while
its measurement list is named <cohort>. prepareData, which crossValidate calls for matrix and DataFrame
input, now stops with "'outcome' is missing or empty".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
@ellispatrick
ellispatrick force-pushed the review/14-crossvalidate-null-outcome branch from 267c036 to 13f0134 Compare October 14, 2026 00:20

This branch has not been deployed

No deployments
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.

1 participant