Model

class pyhf.pdf.Model(spec, batch_size=None, **config_kwargs)[source]

Bases: object

The main pyhf model class.

__init__(spec, batch_size=None, **config_kwargs)[source]

Construct a HistFactory Model.

Parameters
  • spec (jsonable) – The HistFactory JSON specification

  • batch_size (None or int) – Number of simultaneous (batched) Models to compute.

  • config_kwargs – Possible keyword arguments for the model configuration

Returns

The Model instance.

Return type

model (Model)

Attributes

nominal_rates

Nominal value of bin rates of the main model.

Methods

_modifications(pars)[source]
constraint_logpdf(auxdata, pars)[source]

Compute the log value of the constraint pdf.

Parameters
  • auxdata (tensor) – The auxiliary measurement data

  • pars (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 values

  • data (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 data

  • pars (tensor) – The parameter values

Returns

The log density value

Return type

Tensor

make_pdf(pars)[source]

Construct a pdf object for a given set of parameter values.

Parameters

pars (tensor) – The model parameters

Returns

A distribution object implementing the main measurement pdf of HistFactory

Return type

pdf

pdf(pars, data)[source]

Compute the density at a given observed point in data space of the full model.

Parameters
  • pars (tensor) – The parameter values

  • data (tensor) – The measurement data

Returns

The density value

Return type

Tensor