Fix weighted inverse covariance calculation in sWeights#205
Fix weighted inverse covariance calculation in sWeights#205TingzhenXiao wants to merge 5 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #205 +/- ##
========================================
- Coverage 3.74% 3.71% -0.03%
========================================
Files 26 26
Lines 1282 1291 +9
========================================
Hits 48 48
- Misses 1234 1243 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
My supervisor suggested that I tag you here, since the original sWeights implementation was written by you. This PR adds optional while keeping the default behaviour unchanged when Codecov is currently reporting missing coverage for the newly added
Could you please let me know whether this API/design looks reasonable, or whether you would prefer a different implementation? |
eduardo-rodrigues
left a comment
There was a problem hiding this comment.
Dear @TingzhenXiao, thank you very much for the interest in the package and for getting in touch. Are you an LHCb colleague, by chance?
I was not the original author, I think. It must have been @marinang. And then @jonas-eschle took over the maintenance and developments. Let me cc/ping @jonas-eschle as his review and opinions would be most welcome.
Thank you again.
|
(While at it you can,I reckon, remove the CI on macos-15, which is deprecated/retired.) |
Yes, I am currently working on an LHCb-related project with Prof. Eluned Smith at MIT |
Improve sample_weight handling in sWeights
|
Thanks, I have updated the implementation to keep the original unweighted formula for the default |
|
Thanks for the updates so far. Ping again when done with the rest :-). |
Add tests for sample_weight in sWeights
This PR updates the computation of the inverse covariance matrix in
compute_sweightswhensample_weightis provided.Previously, the matrix was evaluated as an unweighted event sum. For efficiency-weighted samples, this does not correspond to the desired weighted approximation of the integral entering the sWeight covariance matrix.
The change replaces the unweighted sum by a weighted matrix product,
where
pNcontains the component PDFs divided by the total extended model PDF. This makes the numerical evaluation consistent with the weighted sample used in the fit.The default behaviour is unchanged when
sample_weight=None.