scikit-hep / pyhf

pure-Python HistFactory implementation with tensors and autodiff
https://pyhf.readthedocs.io/
Apache License 2.0
276 stars 82 forks source link

Pruning bins per channel #1143

Open alexander-held opened 3 years ago

alexander-held commented 3 years ago

Description

It would be great to have a pruning utility to remove distinct bins, instead of just being able to remove full channels. Removing channels is generally useful for fit studies, removing distinct bins can be very useful for debugging weird issues (e.g. to spot problems in the input histogram creation).

Is your feature request related to a problem? Please describe.

When debugging workspaces, I frequently want to see the effect of removing distinct bins to see the effect on fits etc. Removing channels is already very helpful, but more control is useful.

Describe the solution you'd like

An additional pyhf prune option to remove bins, instead of just full channels.

Describe alternatives you've considered

Manual external implementation

Relevant Issues and Pull Requests

none

Additional context

none

lukasheinrich commented 3 years ago

not directly related but related in spirit: #956

alexander-held commented 6 months ago

Adding another use case: it is not uncommon to fit subsets of bins while analyses are still blinded. In some cases this can mean that not necessarily a full channel (like a signal region) is blinded, but only a subset of it (e.g. bins with S/B over some threshold or similar). I think that tooling, which would perform pruning based on some criteria (S/B, S/sqrt(B), etc.), should probably be external to pyhf. An API that drops bins from the model provided by pyhf would be convenient for that though.