Use different weight strategies (like in Nova)#42
Open
roninsightrx wants to merge 5 commits intomainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces configurable, time-based sample downweighting strategies for iterative MAP Bayesian fitting, wiring a new weights scheme option through run_eval()/run_eval_core() and adding tests + documentation.
Changes:
- Add
calculate_fit_weights()to compute weights under multiple schemes (all/last-only/last-two/linear gradient/exponential decay). - Update
handle_sample_weighting()and the iterative fitting loop to apply scheme-based weights to the currently “active” observations. - Add unit tests for the new weighting logic and update VPC snapshots (currently committed as
.new.svgartifacts).
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
R/run_eval.R |
Documents weights as a scheme and passes it into run_eval_core(). |
R/run_eval_core.R |
Applies scheme-based weighting via handle_sample_weighting() and passes computed numeric weights into PKPDmap::get_map_estimates(). |
R/calculate_fit_weights.R |
New exported helper implementing multiple weighting schemes. |
NAMESPACE |
Exports calculate_fit_weights(). |
tests/testthat/test-handle_sample_weighting.R |
Adds tests for scheme application and the no-weights binary behavior. |
tests/testthat/test-calculate_fit_weights.R |
New test file covering each weighting scheme and edge cases. |
tests/testthat/_snaps/run_vpc/nm-vanco-vpc.new.svg |
Snapshot update artifact committed as .new.svg. |
tests/testthat/_snaps/run_vpc/nm-busulfan-vpc.new.svg |
Snapshot update artifact committed as .new.svg. |
man/run_eval.Rd |
Updates weights documentation to describe schemes (contains smart quotes). |
man/run_eval_core.Rd |
Updates weights documentation to describe schemes (contains smart quotes). |
man/handle_sample_weighting.Rd |
Documents new weights arg (contains smart quotes). |
man/calculate_fit_weights.Rd |
Adds documentation for the new exported function. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
No description provided.