Repository navigation
Revise vignette, add relative stopping option, return CV grids from cv.learner() - #8
Merged
Merged
Conversation
control now takes stopping_rule ("absolute" or "relative"), window and
threshold. With the relative rule a change in the objective is divided by the
previous objective, and the fit stops when the last window changes are all
below threshold. The defaults are 5 and 1e-6 for the relative rule and 1 and
0.001 for the absolute rule, which is the old behavior. k and epsilon work as
other names for window and threshold. The default rule is unchanged.
cv.learner() now returns the candidate grids and n_observed, and plot_cv()
reads them, so plot_cv(cv) needs no extra arguments. Explicit arguments still
work and take priority. The heatmap uses a pale to dark blue scale.
The sections are now the base case, separate penalties, multiple sources, and
diagnostics. The accuracy and MSE comparisons are removed, so the vignette only
shows how to use the functions. The sensitivity check has three settings and
runs when the vignette is built. The refits on the CV folds also run, and the
multiple-source part says that some of them reach the iteration limit.
The vignette has Copy buttons and a downloadable script that matches its code
blocks, and the figures have alt text. The Installation section points to
devtools::install_github("stmcg/learner").
The dat_asymmetric help example now fits once and prints the dimensions and
the stopping code instead of comparing errors.
This lets a development build be told apart from 1.1.0.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8 +/- ##
==========================================
+ Coverage 99.11% 99.16% +0.05%
==========================================
Files 7 7
Lines 562 601 +39
==========================================
+ Hits 557 596 +39
Misses 5 5 ☔ 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.
Changes from our October 27 meeting.
Vignette
dat_asymmetrichelp page example now fits once and prints the dimensions and the stopping code, and the error comparison is removed.cv.learner() and plot_cv()
cv.learner()now returns the candidate grids (lambda_1_allandlambda_2_all, orlambda_1_row_all,lambda_1_col_allandlambda_2_allfor separate penalties) andn_observed.plot_cv(cv)uses them, so no extra arguments are needed. The old arguments still work and take priority, so results from earlier versions can still be plotted.Stopping criteria
controlnow takesstopping_rule, either"absolute"(the default, unchanged) or"relative"."relative", a change in the objective isabs(L_t - L_{t-1}) / abs(L_{t-1}), and the fit stops when the lastwindowchanges are all belowthreshold.windowis k andthresholdis epsilon.kandepsilonalso work as names. Giving both names for one setting is an error.1e-6, and I did not tune them further. For the absolute rule they default to 1 and0.001, which is the old behavior.windowworks with both rules, sowindow = 1compares only adjacent values.max_iterstays separate. The check for an objective that grows too much (code 3) is kept. With the relative rule it runs before the convergence test, so a largethresholdcannot hide a diverging fit. Athresholdof 0 disables convergence stopping; the fit continues tomax_iterunless a failure safeguard triggers code 3.?learnerandNEWS.md. The vignette does not use it. I called the rule"relative", and that name is easy to change.dat_asymmetricwithlambda_1 = 0I multiplied the data by 0.1, 1 and 10. The relative rule stops after 784 updates each time. The absolute rule stops after 656 and 770 updates, and reaches the limit of 5000 at the largest scale.Also changed
devtools::install_github("stmcg/learner"), and so does the header of the script. This only works once these changes are inmain. To try this branch before that, usedevtools::install_github("stmcg/learner@stopping-rule-option").vignettes/copy-code.html), andinst/examples/advanced-learner.Rhas the same code as the blocks. The figures have alt text.test-cv-multisource.Randtest-reference-regression.Rare adjusted for the new fields in the CV result. The helper used by the stopping tests moved totests/testthat/helper-stopping.R. There are new tests for the stopping option and for the stored CV grids.Questions
max_iteris still 100. That is small for both rules on the example data, and the help page says so. Would you like me to raise the default, or is it better to leave it as it is?Checks
R CMD check --no-manualgives Status OK on macOS (R 4.6.1), all 494 expectations pass, and the vignette builds in about 12 seconds. I have not checked the PDF manual or other platforms. GitHub Actions should cover those. I also looked through the examples on the other help pages, and none of them compares performance.Please merge with a regular merge commit.