Skip to content

Use different weight strategies (like in Nova)#42

Open
roninsightrx wants to merge 5 commits intomainfrom
weights
Open

Use different weight strategies (like in Nova)#42
roninsightrx wants to merge 5 commits intomainfrom
weights

Conversation

@roninsightrx
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.svg artifacts).

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.

@roninsightrx roninsightrx changed the title Use different weight strategies Use different weight strategies (like in Nova) Apr 3, 2026
roninsightrx and others added 3 commits April 3, 2026 15:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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