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

feat: support models with custom modifiers #385

Open alexander-held opened 1 year ago

alexander-held commented 1 year ago

Add support for handling models with custom modifiers as introduced in https://github.com/scikit-hep/pyhf/pull/1991. This means adding a validate kwarg to model_utils.model_and_data to allow turning off workspace / model validation against the respective JSON schema (users could provide their own via the pyhf API, see pyhf.schema.Schema docs). The modifier_set kwarg can be used to inject custom modifiers.

At the moment this also adds a poi_name kwarg to support the use case in #382, but that may be argued to be an invalid model specification to begin with, so it is not clear to me whether this would be generally needed. The fit API is meant to not rely on this option (to also more easily support multi-POI setups) so this may somewhat go against the design philosophy here.

to-do:

may potentially resolve #382

* allow turning off workspace and model validation in model_utils.model_and_data
* allow injecting custom modifiers into model creation in model_utils.model_and_data
* support setting POI in model_utils.model_and_data
codecov[bot] commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (f116d4e) to head (2decbe8).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #385 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 22 22 Lines 2093 2094 +1 Branches 344 344 ========================================= + Hits 2093 2094 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

rmnmllr commented 1 year ago

hey @alexander-held, would it be possible to merge the latest base branch into the feat/custom-modifier-models branch? I would like to use the latest fixes with the custom modifiers.

alexander-held commented 1 year ago

Hi @rmnmllr, sure, this branch includes the changes from master now.