Skip to content

Multiple correlated modifiers acting on same distribution result in silent skipping #2602

@alexander-held

Description

@alexander-held

Summary

For models where a sample in a given channel is affected by multiple modifiers of the same type with the same name, only one of the modifiers is kept and the rest is silently dropped.

I am not sure if support for this is in scope of HistFactory. There is one natural way I see to handle such cases, which is to handle the automatic combination at the modifier level (normsys compose multiplicatively, histosys additively). A two-NP model with both NPs evaluated at +1 should predict the same distribution as a one-NP model with that NP evaluated at +1. With a distinction between modifiers and parameters controlling them, that would be equivalent to keeping both modifiers and equating the parameters.

If out of scope, I think such cases need to raise an error as the current behavior could easily be missed.

Use case example: I ran into this in a scenario where object calibrations are correlated and separate variations are produced but then are recommended to be correlated. Users could combine histograms externally, but the most natural idea was to just do it within the model.

somewhat related: #1830

OS / Environment

n/a

Steps to Reproduce

import pyhf

spec = {
    "channels": [
        {
            "name": "SR",
            "samples": [
                {
                    "data": [50],
                    "modifiers": [
                        {
                            "data": {"hi": 1.2, "lo": 0.8},
                            "name": "np1",
                            "type": "normsys"
                        },
                        {
                            "data": {"hi": 1.3, "lo": 0.7},
                            "name": "np1",
                            "type": "normsys"
                        }
                    ],
                    "name": "sample"
                }
            ]
        }
    ],
    "measurements": [
        {
            "config": {"parameters": [], "poi": ""},
            "name": "test"
        }
    ],
    "observations": [{"data": [50], "name": "SR"}],
    "version": "1.0.0"
}

ws = pyhf.Workspace(spec)
model = ws.model()
print(model.expected_data([1.0], include_auxdata=False))

File Upload (optional)

No response

Expected Results

[78.] (1.2 * 1.3 * 50) or raising an error

Actual Results

[65.]

pyhf Version

HEAD

Code of Conduct

  • I agree to follow the Code of Conduct

Metadata

Metadata

Labels

bugSomething isn't workingneeds-triageNeeds a maintainer to categorize and assign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions