_ModelConfig¶
- class pyhf.pdf._ModelConfig(spec, **config_kwargs)[source]¶
Bases:
pyhf.mixins._ChannelSummaryMixin
Configuration for the
Model
.Note
_ModelConfig
should not be called directly. It should instead by accessed through theconfig
attribute ofModel
.- __init__(spec, **config_kwargs)[source]¶
- Parameters
spec (
jsonable
) – The HistFactory JSON specification.
Methods
- par_names()[source]¶
The names of the parameters in the model including binned-parameter indexing.
- Returns
Names of the model parameters.
- Return type
Example
>>> import pyhf >>> model = pyhf.simplemodels.uncorrelated_background( ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] ... ) >>> model.config.par_names() ['mu', 'uncorr_bkguncrt[0]', 'uncorr_bkguncrt[1]']
- par_slice(name)[source]¶
The slice of the model parameter tensor corresponding to the model parameter
name
.- Returns
Slice of the model parameter tensor.
- Return type
Example
>>> import pyhf >>> model = pyhf.simplemodels.uncorrelated_background( ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] ... ) >>> model.config.par_slice("uncorr_bkguncrt") slice(1, 3, None)
- param_set(name)[source]¶
The
paramset
for the model parametername
.- Returns
Corresponding
paramset
.- Return type
paramsets
Example
>>> import pyhf >>> model = pyhf.simplemodels.uncorrelated_background( ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] ... ) >>> param_set = model.config.param_set("uncorr_bkguncrt") >>> param_set.pdf_type 'poisson'
- set_poi(name)[source]¶
Set the model parameter of interest to be model parameter
name
.Example
>>> import pyhf >>> model = pyhf.simplemodels.uncorrelated_background( ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] ... ) >>> model.config.set_poi("mu") >>> model.config.poi_name 'mu'
- suggested_bounds()[source]¶
Return suggested parameter bounds for the model.
- Returns
Suggested bounds on model parameters.
- Return type
Example
>>> import pyhf >>> model = pyhf.simplemodels.uncorrelated_background( ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] ... ) >>> model.config.suggested_bounds() [(0, 10), (1e-10, 10.0), (1e-10, 10.0)]
- suggested_fixed()[source]¶
Identify the fixed parameters in the model.
- Returns
A list of booleans,
True
for fixed andFalse
for not fixed.- Return type
Example
>>> import pyhf >>> model = pyhf.simplemodels.uncorrelated_background( ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] ... ) >>> model.config.suggested_fixed() [False, False, False]
Something like the following to build
fixed_vals
appropriately:fixed_pars = model.config.suggested_fixed() inits = model.config.suggested_init() fixed_vals = [ (index, init) for index, (init, is_fixed) in enumerate(zip(inits, fixed_pars)) if is_fixed ]
- suggested_init()[source]¶
Return suggested initial parameter values for the model.
- Returns
Suggested initial model parameters.
- Return type
Example
>>> import pyhf >>> model = pyhf.simplemodels.uncorrelated_background( ... signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] ... ) >>> model.config.suggested_init() [1.0, 1.0, 1.0]