-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Update NPResult to contain the posterior and predictions #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 updates the NPResult structure to contain pre-calculated Posterior probabilities and optional NPPredictions, improving efficiency by calculating posterior probabilities once during initialization rather than repeatedly when needed.
- Adds
posteriorandpredictionsfields toNPResult, calculated during initialization - Changes
NPResult::new()to returnResult<Self>to handle potential posterior calculation failures - Introduces
calculate_predictions()method to lazily compute and store predictions - Updates parameter passing from owned
Thetato borrowed&Thetafor efficiency
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/structs/theta.rs | Adds write_with_weights() method to write theta with corresponding weights to CSV |
| src/routines/output/predictions.rs | Changes parameter from owned Theta to borrowed reference for efficiency |
| src/routines/output/mod.rs | Adds posterior and predictions fields to NPResult, implements calculate_predictions(), and updates methods to use cached posterior |
| src/bestdose/predictions.rs | Updates call to NPPredictions::calculate() with borrowed theta reference |
| src/algorithms/postprob.rs | Changes into_npresult() signature to return Result<NPResult<E>> |
| src/algorithms/npod.rs | Changes into_npresult() signature to return Result<NPResult<E>> |
| src/algorithms/npag.rs | Changes into_npresult() signature to return Result<NPResult<E>> |
| src/algorithms/mod.rs | Updates trait definition for into_npresult() to return Result and propagates error in fit() |
| examples/vanco_sde/main.rs | Makes result mutable to support new write_outputs() signature |
| examples/two_eq_lag/main.rs | Makes result mutable to support new write_outputs() signature |
| examples/theophylline/main.rs | Makes result mutable to support new write_outputs() signature |
| examples/new_iov/main.rs | Makes result mutable to support new write_outputs() signature |
| examples/neely/main.rs | Makes result mutable to support new write_outputs() signature |
| examples/meta/main.rs | Makes result mutable to support new write_outputs() signature |
| examples/iov/main.rs | Makes result mutable to support new write_outputs() signature |
| examples/drusano/main.rs | Makes result mutable and handles error from into_npresult() |
| examples/bimodal_ke/main.rs | Makes result mutable to support new write_outputs() signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
| Branch | outputs-outputs-outputs |
| Testbed | rust-moan |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result seconds (s) (Result Δ%) | Upper Boundary seconds (s) (Limit %) |
|---|---|---|---|
| bimodal_ke_npag | 📈 view plot 🚷 view threshold | 25.20 s(+0.07%)Baseline: 25.18 s | 26.40 s (95.47%) |
| bimodal_ke_npod | 📈 view plot 🚷 view threshold | 10.45 s(-0.24%)Baseline: 10.47 s | 10.68 s (97.86%) |
| bimodal_ke_postprob | 📈 view plot 🚷 view threshold | 3.47 s(-0.12%)Baseline: 3.47 s | 3.54 s (97.95%) |
* some methods needed in hermes * clean
No description provided.