Model
- class pyhf.pdf.Model(spec, modifier_set=None, batch_size=None, validate: bool = True, clip_sample_data: Optional[float] = None, clip_bin_data: Optional[float] = None, **config_kwargs)[source]
Bases:
object
The main pyhf model class.
- __init__(spec, modifier_set=None, batch_size=None, validate: bool = True, clip_sample_data: Optional[float] = None, clip_bin_data: Optional[float] = None, **config_kwargs)[source]
Construct a HistFactory Model.
- Parameters
spec (
jsonable
) – The HistFactory JSON specificationbatch_size (
None
orint
) – Number of simultaneous (batched) Models to compute.validate (
bool
) – Whether to validate against a JSON schemaclip_sample_data (
None
orfloat
) – Clip the minimum value of expected data by-sample. Default is no clipping.clip_bin_data (
None
orfloat
) – Clip the minimum value of expected data by-bin. Default is no clipping.config_kwargs – Possible keyword arguments for the model configuration
- Returns
The Model instance.
- Return type
model (
Model
)
Attributes
- config
The
_ModelConfig
instance for the model.
- nominal_rates
Nominal value of bin rates of the main model.
Methods
- constraint_logpdf(auxdata, pars)[source]
Compute the log value of the constraint pdf.
- Parameters
auxdata (
tensor
) – The auxiliary measurement datapars (
tensor
) – The parameter values
- Returns
The log density value
- Return type
Tensor
- expected_actualdata(pars)[source]
Compute the expected value of the main model.
- Parameters
pars (
tensor
) – The parameter values- Returns
The expected data of the main model (no auxiliary data)
- Return type
Tensor
- expected_auxdata(pars)[source]
Compute the expected value of the auxiliary measurements.
- Parameters
pars (
tensor
) – The parameter values- Returns
The expected data of the auxiliary pdf
- Return type
Tensor
- expected_data(pars, include_auxdata=True)[source]
Compute the expected value of the main model
- Parameters
pars (
tensor
) – The parameter values- Returns
The expected data of the main and auxiliary model
- Return type
Tensor
- logpdf(pars, data)[source]
Compute the log value of the full density.
- Parameters
pars (
tensor
) – The parameter valuesdata (
tensor
) – The measurement data
- Returns
The log density value
- Return type
Tensor
- mainlogpdf(maindata, pars)[source]
Compute the log value of the main term.
- Parameters
maindata (
tensor
) – The main measurement datapars (
tensor
) – The parameter values
- Returns
The log density value
- Return type
Tensor