scikit-hep / cabinetry

design and steer profile likelihood fits
https://cabinetry.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
26 stars 21 forks source link

fix: saturated likelihood evaluation with custom auxiliary data #378

Closed alexander-held closed 1 year ago

alexander-held commented 1 year ago

The evaluation of the constraint term in the saturated likelihood for goodness-of-fit testing previously used the suggested parameter values for a given model. Those maximize the constraint term only if the auxiliary data used in the fit for which the GOF is being evaluated corresponds to the default model.config.auxdata.

This fixes the construction of the parameter values used in the constraint term evaluation to ensure the saturated likelihood is correctly evaluated. Parameter values can be picked up from auxiliary data if they correspond to modifiers with associated constraints, with scaling required for Poisson terms. Other parameter values (corresponding to free-floating parameters) can be picked up from model.config.suggested_init(), but do not matter for the constraint term likelihood regardless.

This requires #380 for CI to pass due to #379.

* fix: correctly evaluate the constraint term for the saturated likelihood with best-fit parameters
* updated pre-commit

resolves #377

codecov[bot] commented 1 year ago

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage :thumbsup:

Coverage data is based on head (a7216b4) compared to base (4181499). Patch coverage: 100.00% of modified lines in pull request are covered.

:exclamation: Current head a7216b4 differs from pull request most recent head 236c1d4. Consider uploading reports for the commit 236c1d4 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #378 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 23 23 Lines 2020 2041 +21 Branches 319 324 +5 ========================================= + Hits 2020 2041 +21 ``` | [Impacted Files](https://codecov.io/gh/scikit-hep/cabinetry/pull/378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep) | Coverage Δ | | |---|---|---| | [src/cabinetry/fit/\_\_init\_\_.py](https://codecov.io/gh/scikit-hep/cabinetry/pull/378/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep#diff-c3JjL2NhYmluZXRyeS9maXQvX19pbml0X18ucHk=) | `100.00% <100.00%> (ø)` | | | [src/cabinetry/model\_utils.py](https://codecov.io/gh/scikit-hep/cabinetry/pull/378/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep#diff-c3JjL2NhYmluZXRyeS9tb2RlbF91dGlscy5weQ==) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.