Repository navigation
Bring the plotting functions into main, with a simpler README, new example data, and an advanced vignette - #7
Merged
Merged
Conversation
Add plots for objectives, CV, latent spaces, and contributions
The three preview images were made for the pull request description and are not referenced anywhere. The guide repeats the help pages and README.
Describe first what each plot shows and how to read it. State that the shaded band in plot_objective() is not a confidence interval, and give plot_contributions() its own description of limits. Only documentation and comments change; the function code is unchanged.
Keep the original single-source walk-through and its wording. Add plot_cv() for the cross-validation results and plot_objective() for the objective function, and note that plot_cv() needs ggplot2.
Drop the shaded band, its average line and the legend. The near-optimum window holds at most 41 records, so the values can be drawn directly, and values that alternate between two levels appear as a zigzag. Mark each iteration with a dot when 100 or fewer are shown. The subtitle already gives the minimum.
The source and target share the row (U) latent space but have different column (V) spaces, following the U-shared, V-perturbed construction in the paper's simulation code. Include the generating script, the help page, a structure test and a short example.
Introduce the two extensions one at a time: multiple sources with a common penalty, then a single source with separate row and column penalties on dat_asymmetric. Link the tutorial from the README, add knitr and rmarkdown to Suggests, and add a NEWS entry.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7 +/- ##
==========================================
+ Coverage 97.95% 99.11% +1.15%
==========================================
Files 5 7 +2
Lines 244 562 +318
==========================================
+ Hits 239 557 +318
Misses 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Shorten the argument descriptions and return values of plot_cv(), plot_objective(), plot_source_spaces() and plot_contributions() so that they say what each option does without implementation details. Only the documentation changes.
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.
This PR brings the plotting functions into
main, makes the README and help-page changes we discussed, and adds an example dataset and an advanced tutorial.#6 was merged into
multisource-penalties-cleanafter #5 had already gone intomain, so the plotting code is not inmainyet. The first commit here brings it over, which means the diff also contains code you have already reviewed. The subsequent commits contain the documentation, plotting, dataset, and tutorial updates.README, plots and help pages
plot_cv()for the CV results,plot_objective()in place of the base R plot, a note thatplot_cv()needs ggplot2, and a link to the tutorial. The finallearner()call uses the penalties chosen by CV (the same values as before), and I set a seed so they can be reproduced.plot_objective()now draws the raw objective values in the near-optimum view instead of the shaded band and average line. That view shows at most 41 records, so the raw values can be drawn directly, and an objective that alternates between two levels shows up as a zigzag. I also dropped the legend, since the subtitle already gives the minimum, and each iteration gets a dot when 100 or fewer are shown. This is the only change to the code from Add plots for objectives, CV, latent spaces, and contributions #6; the rest of the PR is docs and data. The near-optimum view below shows iterations 38–78 from the README fit. Each blue dot is a recorded objective value, and the red dot marks the smallest recorded value at iteration 58.plot_contributions()now documents its ownlimitsargument.Example data and tutorial
dat_asymmetrichas one source and one target (100 × 50, rank 3). The U-spaces are shared and the V-spaces differ. The paper's Supporting Information calls this "same column spaces but different row spaces", since the span of U is the column space of the signal matrix. In the package,lambda_1_rowpenalizes U andlambda_1_colpenalizes V. The data follow the low-similarity scenario in Section 2.4.1 of the Supporting Information (set_theta_Ushared_Vdiff()withdif_factor_v = 2), with noise variance 0.01 for the source and 0.10 for the target. The generating script isdata-raw/gen-asymmetric.R, and there is a help page with an example and a test.vignettes/advanced-learner.Rmd, titled LEARNER and D-LEARNER: Multiple Sources, Source Weights, and Separate Penalties, introduces the source data and fixed weights, then explains D-LEARNER and LEARNER in separate sections. D-LEARNER uses the weighted source spaces without penalty tuning; LEARNER holds those weights fixed while selecting penalties by CV. A single-source asymmetric example then introduces separate U- and V-space penalties. Formulas, runnable examples, and detailed interpretation are retained, with a table of contents.NEWS.mdentry. The heatmap chunks in the tutorial are skipped if ggplot2 is missing or older than 3.4.0, which is whatplot_cv()requires.On
dat_asymmetric, CV with separate penalties picks U = 100 and V = 10, and a common penalty picks 10 for both. The separate fit has the lower Frobenius error (4.07 against 4.76), and both final fits meet the stopping rule. The tutorial also says what is not settled: about a third of the CV fits reach the iteration limit, and the chosen U penalty (100) and the common balance penalty (0.001) sit at the edge of their grids. The choices did not change when I doubled the iteration budget or used step sizes from 0.0005 to 0.005 (with more iterations for the smaller steps), but with step size 0.01 the separate search chose a different balance penalty. This is one simulated dataset, so I treat it as an illustration and not a performance comparison.Questions
dat_asymmetricfor the tutorial. We can also try other choices.Checks
R CMD check --no-manualgives Status OK on macOS (R 4.6.1), 401 expectations pass, and the tutorial builds in under 20 seconds. GitHub Actions checks pass on macOS, Windows, and Linux (code revision440757c). I have not checked the PDF manual or multithreaded runs locally.The revised vignette was rendered locally, and both optional diagnostic code blocks were executed successfully. The main asymmetric comparison remains 4.07 versus 4.76; the reconstructed inner-CV counts remain 33/108 for the separate search and 12/36 for the common search. Checks for the new documentation commit will run on GitHub Actions.
Please merge with a regular merge commit.