-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Update calculation of predictions #159
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
base: main
Are you sure you want to change the base?
feat: Update calculation of predictions #159
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 changes the calculation method for population and individual predictions from using the weighted mean/median support points to using the weighted mean/median of the actual response values. This represents a fundamental shift in how predictions are computed, moving from parameter-space averaging to response-space averaging.
Key changes:
- Modified prediction calculation to compute weighted mean/median of simulated responses instead of simulating from weighted mean/median parameters
- Updated
weighted_median
function signature to useVec<f64>
instead ofArray1<f64>
for consistency - Added comprehensive simulation across all support points for each subject before aggregating results
Comments suppressed due to low confidence (4)
src/routines/output.rs:430
- The variable name
spp
is ambiguous. Consider renaming it tosupport_point
ortheta_row
to make its purpose clearer.
for spp in theta.row_iter() {
src/routines/output.rs:432
- The variable name
spp_values
is ambiguous. Consider renaming it tosupport_point_values
ortheta_values
to make its purpose clearer.
let spp_values = spp.iter().cloned().collect::<Vec<f64>>();
src/routines/output.rs:446
- The variable name
outer_pred
is unclear. Consider renaming it tosupport_point_predictions
orspp_predictions
to better indicate it represents predictions from a specific support point.
for outer_pred in predictions.iter().enumerate() {
src/routines/output.rs:448
- The variable name
inner_pred
is unclear. Consider renaming it totime_point_prediction
orprediction_at_time
to better indicate it represents a prediction at a specific time point.
for inner_pred in outer_pred.iter().enumerate() {
@@ -764,7 +785,7 @@ pub fn median(data: Vec<f64>) -> f64 { | |||
} | |||
} | |||
|
|||
fn weighted_median(data: &Array1<f64>, weights: &Array1<f64>) -> f64 { | |||
fn weighted_median(data: &Vec<f64>, weights: &Vec<f64>) -> f64 { |
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.
Function parameters should use slice references (&[f64]
) instead of &Vec<f64>
for better API design and flexibility. This allows the function to accept both vectors and slices.
fn weighted_median(data: &Vec<f64>, weights: &Vec<f64>) -> f64 { | |
fn weighted_median(data: &[f64], weights: &[f64]) -> f64 { |
Copilot uses AI. Check for mistakes.
|
Branch | 157-change-how-meanmedian-population-predictions-are-calculated |
Testbed | orion |
Click to view all benchmark results
Benchmark | Latency | Benchmark Result seconds (s) (Result Δ%) | Upper Boundary seconds (s) (Limit %) |
---|---|---|---|
bimodal_ke_fit | 📈 view plot 🚷 view threshold | 10.13 s(-32.34%)Baseline: 14.97 s | 26.46 s (38.29%) |
Before this can be merged, we need to handle the occasion correctly. |
Population and individual predictions are now calculated using the (weighted) mean/median response, instead of the (weighted) mean/median support.