pyhs3.likelihoods.Likelihood¶
- class pyhs3.likelihoods.Likelihood(**data)[source]¶
Likelihood specification mapping distributions to observations.
Represents a likelihood function that combines parameterized distributions with observations to generate a likelihood function L(θ₁, θ₂, …). The likelihood is the product of PDFs evaluated at observed data points.
- Variables:
name – Custom string identifier for the likelihood
distributions – Array of strings referencing distributions
data – Array of strings referencing data or inline values for constraints
aux_distributions – Optional array of auxiliary distributions for regularization
- Parameters:
data (
Any)
Fields¶ Field
Type
Required
Default
list[str] |Distributions|NoneNo
NoneYes
list[str] |DistributionsYes
Yes
Validators¶ Validator
Mode
Fields
after
model
- __init__(**data)¶
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (
Any)
Methods
Binned data keyed by the
{distribution}_observedinput it supplies.Observable data as numpy arrays keyed by axis name.
Names of the distributions this likelihood evaluates, auxiliary ones included.
Validate that distributions and data are properly paired.
validate_unique_axis_names([workspace])Raise ValueError if any observable axis name appears more than once.
Attributes
- Likelihood.binned_observed_inputs()[source]¶
Binned data keyed by the
{distribution}_observedinput it supplies.A distribution paired with
BinnedData(a HistFactory channel, for example) reads its observed bin counts from the input named{distribution}_observed. These inputs are data, not parameters.- Return type:
- Likelihood.data_arrays()[source]¶
Observable data as numpy arrays keyed by axis name.
Returns a dict mapping each observable axis name to a 1-D float64 array of event values. Only data entries with both
axesandentriesare included (i.e.UnbinnedData).Suitable for passing directly to compiled or JAX functions:
fn(**likelihood.data_arrays(), **params)
- Likelihood.distribution_names()[source]¶
Names of the distributions this likelihood evaluates, auxiliary ones included.
- Likelihood.validate_distributions_data_pairing()[source]¶
Validate that distributions and data are properly paired.
- Return type:
- Likelihood.validate_unique_axis_names(workspace=None)[source]¶
Raise ValueError if any observable axis name appears more than once.
When workspace is provided, unresolved string FK references in
dataare resolved viaworkspace.databefore checking. Without a workspace, string entries are skipped.
- Likelihood.distributions¶
- Likelihood.data¶
- Likelihood.aux_distributions¶
- Likelihood.name¶