Skip to content

Add plots for objectives, CV, latent spaces, and contributions - #6

Merged
stmcg merged 10 commits into
multisource-penalties-cleanfrom
plotting-diagnostics-clean
Oct 19, 2026
Merged

stmcg merged 10 commits into
multisource-penalties-cleanfrom
plotting-diagnostics-clean

Conversation

@Jodielidada

@Jodielidada Jodielidada commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds plot_objective() for recorded optimization histories, plot_cv() for common/separate-penalty heatmaps, plot_source_spaces() for population projection matrices, and plot_contributions() for squared singular-vector entries. Only the CV heatmap needs optional ggplot2.

Plotting behavior and examples

plot_objective() shows all iterations, a numeric selection (iterations beyond the recorded history are ignored), or a window of up to 41 iterations centered on the recorded minimum. README shows an objective plot for the single-source example, and CV output, its heatmap, and a comparison of source choices using dat_multisource. Examples, help pages, and NEWS are updated. plot_cv_profile() from #4 is not carried over, to keep the package easier to maintain.

README also presents the second source comparison added in #5, showing the results when both sources have appreciable noise.

Testing and merge order

Local tests and R CMD check --no-manual --no-build-vignettes pass (macOS, R 4.6.1), and GitHub Actions pass on macOS, Windows, and Ubuntu. Replaces #4 and depends on #5. Please merge #5 with a regular merge commit; if it is squash-merged, I will need to rebase this branch before merging it.

Plot examples

Objective function

The same fit shown over all iterations, iterations 1–200, and a window of 20 iterations on either side of the minimum recorded value; the shaded band shows consecutive objective values, not uncertainty.

Objective function: all iterations, specified range, and near the recorded minimum

Cross-validation

The heatmap compares the candidate penalties, with a black box marking the selected combination.

Cross-validation heatmap

Source spaces and contributions

The space plots compare the target and two source populations; the contribution plots show squared singular-vector entries for the three components of the fitted target matrix.

Target and source latent spaces

D-LEARNER variable contributions

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.18%. Comparing base (a72af46) to head (279c45e).

Additional details and impacted files
@@                       Coverage Diff                       @@
##           multisource-penalties-clean       #6      +/-   ##
===============================================================
+ Coverage                        97.95%   99.18%   +1.23%     
===============================================================
  Files                                5        7       +2     
  Lines                              244      614     +370     
===============================================================
+ Hits                               239      609     +370     
  Misses                               5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Jodielidada Jodielidada changed the title Add objective, CV, and latent-space plotting diagnostics Add plots for objectives, CV, latent spaces, and contributions Oct 16, 2026
@Jodielidada
Jodielidada requested a review from stmcg October 16, 2026 18:09
@stmcg
stmcg merged commit 7de8372 into multisource-penalties-clean Oct 19, 2026
8 checks passed
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.

2 participants