Repository navigation
10/ Metrics and plots: no internal rounding, tied risks count 1/2, fold grouping for all metrics, chance line per metric (changes results slightly) - #136
Merged
Conversation
ellispatrick
force-pushed
the
review/9-coxnet-path
branch
from
October 10, 2026 22:47
9bff739 to
c712639
Compare
ellispatrick
force-pushed
the
review/10-metrics-defaults
branch
from
October 10, 2026 22:47
8c90bcb to
45f9c63
Compare
…rouping for every metric, chance line per metric (changes results)
Decisions by Ellis Patrick, 10 Oct 2026 (ProjectClassifyR docs/DECISIONS.md, QUESTIONS.md Q6-Q12, Q19):
- AUC, the sample-wise C-index, crissCrossValidate's matrices and runTest's variable importance are no longer
rounded; plots round only their labels.
- The sample-wise C-index counts a pair with tied risk scores as half concordant, as the C-index does.
- grouping = "fold" averages every class metric (e.g. Balanced Accuracy) within each permutation, as it already did
for AUC and C-index.
- Macro precision and F1 count a never-predicted class as precision 0 instead of returning NaN.
- AUC of a group lacking a sample of some class is NaN with a warning, instead of an error.
- performancePlot's chance line is the metric's value under uniformly random predictions (1/k, 1 - 1/k, 0.5 or 0),
and is omitted for metrics without one.
- rankingPlot divides the overlap by the length of the shorter list of top features; the overlap plots' axis labels
say what they measure ("Top Features in Common", "Jaccard Similarity").
- crissCrossPlot hides the diagonal by default for both training types; showDiagonal = TRUE shows it
(showResubMetric is deprecated).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4
ellispatrick
force-pushed
the
review/10-metrics-defaults
branch
from
October 14, 2026 00:20
45f9c63 to
6708fc0
Compare
ellispatrick
force-pushed
the
review/9-coxnet-path
branch
from
October 14, 2026 00:20
c712639 to
333aa6c
Compare
DarioS
marked this pull request as ready for review
October 28, 2026 02:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes results slightly (decided by Ellis Patrick). These are metric and plot definitions; no predictions change.
crissCrossValidate's performance matrices andrunTest's variable importance are no longer rounded either. Plots round only their labels.survival::concordance). It used to be dropped.grouping = "fold": every class metric (e.g. Balanced Accuracy, Macro F1) is now calculated per fold and averaged within each permutation, as AUC and C-index already were. It used to return one value per fold (500 values for 100 × 5).NaN.NaNwith a warning, not an error.top, when a ranking has fewer features. Axis labels now say what is measured: "Average Top Features in Common (%)" for rankingPlot and "Jaccard Similarity (%)" for selectionPlot. Both used to say "Common Features (%)" although they compute different things.showDiagonal = TRUEshows it.showResubMetricstill works, with a deprecation warning.Why
Ellis's answers to the open questions (ProjectClassifyR
docs/DECISIONS.md, 10 Oct 2026;docs/QUESTIONS.mdQ6–Q12, Q19):NaNmacro precision made a whole permutation's value missing.What changes
R/calcPerformance.R,R/utilities.R(.calcArea),R/ROCplot.R,R/performancePlot.R(new.chanceLevel),R/rankingPlot.R(new.topOverlap),R/selectionPlot.R,R/crissCrossValidate.R,R/runTest.R; help pages regenerated.Tests:
NaNwith a warning;The reference implementations in the tests are updated to the new definitions.
Evidence
Tests and check: 570 test expectations pass. R CMD check gives only the existing NOTEs (
.doSelectionglobals;.gitfrom building in a worktree).Regression harness (18 scenarios, the build of 9/9 Cox elastic net: lambda path ends at 0.05 of the largest value by default (changes results; 6.6x faster) #134 against this one): 17 are identical.
proc4_crisscrossdiffers only by the removed rounding, e.g. 0.98 → 0.9844 and 0.96 → 0.9569.Metric values on results computed once, evaluated under both builds (asthma DLDA 20 × 5; asthma random forest 5 × 5; Procedure 1 random forest; METABRIC clinical CoxPH 20 × 5):
grouping = "fold"Scripts: ProjectClassifyR
scripts/metrics_defaults/.🤖 Generated with Claude Code
https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4