Repository navigation
Add plotting diagnostics for fits, cross-validation, and latent spaces - #4
Closed
Jodielidada wants to merge 9 commits into
Closed
Jodielidada wants to merge 9 commits into
Jodielidada wants to merge 9 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## multiple-sources-separate-penalties #4 +/- ##
=======================================================================
+ Coverage 95.02% 97.92% +2.89%
=======================================================================
Files 5 7 +2
Lines 241 577 +336
=======================================================================
+ Hits 229 565 +336
Misses 12 12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
This PR adds exported plotting helpers for checking convergence, inspecting CV tuning grids, and visualizing latent spaces. They follow the displays used in the paper and its Supporting Information. ggplot2 is an optional dependency (Suggests), and only
plot_cv()needs it. All estimation functions and the other plots work without it.New functions
plot_objective()plot_cv()plot_cv_profile()plot_source_spaces()plot_contributions()plot_simulation_results()Each function validates its inputs.
plot_cv()returns a list containing the first ggplot page in$plotand all pages in$plots, so users can customize or export individual pages withggsave().Design notes
plot_cv()labels finite scores aboverelative_limitas "high error" instead of "diverged", since a high CV score alone does not prove the optimizer diverged. If the minimum score is zero, the plot falls back to absolute scores.cv.learner()does not store the candidate grids, soplot_cv()/plot_cv_profile()take the grids as arguments. If you'd like, a follow-up could add the grids to thecv.learner()output so thatplot_cv(cv)works on its own.Dependencies
plot_cv()checks for it withrequireNamespace()and stops with an install hint if it is missing. Tests that need ggplot2 useskip_if_not_installed(), and the Rd examples are guarded the same way.graphics,grDevices, andstatsare added to Imports. They are base R packages, so this adds no new installs. The minimum R version stays at 2.10.Testing
R CMD check --no-manual: Status OK (0 errors, 0 warnings, 0 notes) on macOS, R 4.6.1.The test suite has 297 passing expectations. New test files:
test-plotting.Rtest-cv-heatmap-style.Rtest-paper-plots.RNew runnable examples:
inst/examples/plot-diagnostics.Randinst/examples/plot-paper-displays.R. There is also a short guide ininst/examples/plotting-guide.md.I also tested an isolated R library without ggplot2. Estimation and the other plotting functions worked, and
plot_cv()returned an installation message.Question for review
plot_simulation_results()andplot_source_spaces()are closer to paper-reproduction tools than general diagnostics. I'm happy to move them tolearner-paperif you'd prefer to keep the package API smaller.