pyhs3.distributions.MixtureDist¶
- class pyhs3.distributions.MixtureDist(**data)[source]¶
Mixture of probability distributions.
Implements a weighted combination of multiple distributions following ROOT’s RooAddPdf. Supports both N and N-1 coefficient configurations where \(N\) represents number of distributions (summands):
N-1 coefficients:
\[f(x) = \sum_{i=1}^{n-1} c_i \cdot f_i(x) + (1 - \sum_{i=1}^{n-1} c_i) \cdot f_n(x)\]N coefficients:
\[f(x) = \frac{\sum_{i=1}^{n} c_i \cdot f_i(x)}{\sum_{i=1}^{n} c_i}\]N coefficients with `ref_coef_norm`:
\[f(x) = \frac{\sum_{i=1}^{n} c_i \cdot f_i(x)}{\sum_{j \in \text{ref\_coef\_norm}} c_j}\]- Parameters:
- ROOT Reference:
- Parameters:
data (
Any
)
- __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
__init__
(**data)Create a new model by parsing and validating input data from keyword arguments.
construct
([_fields_set])copy
(*[, include, exclude, update, deep])Returns a copy of the model.
dict
(*[, include, exclude, by_alias, ...])expected_yield
(context)Compute the total expected yield nu in the extended case.
expression
(context)Builds a symbolic expression for the mixture distribution.
extended_likelihood
(context, n_observed)Poisson term for the extended likelihood.
from_orm
(obj)get_parameter_list
(context, param_key)Reconstruct a parameter list from flattened indexed keys.
json
(*[, include, exclude, by_alias, ...])model_construct
([_fields_set])Creates a new instance of the Model class with validated data.
model_copy
(*[, update, deep])!!! abstract "Usage Documentation"
model_dump
(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json
(*[, indent, include, ...])!!! abstract "Usage Documentation"
model_json_schema
([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name
(params)Compute the class name for parametrizations of generic classes.
model_post_init
(context, /)This function is meant to behave like a BaseModel method to initialise private attributes.
model_rebuild
(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate
(obj, *[, strict, ...])Validate a pydantic model instance.
model_validate_json
(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings
(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
parse_file
(path, *[, content_type, ...])parse_obj
(obj)parse_raw
(b, *[, content_type, encoding, ...])process_parameter
(param_key)Process a single parameter that can be either a string reference or numeric value.
process_parameter_list
(param_key)Process a list parameter containing mixed string references and numeric values.
schema
([by_alias, ref_template])schema_json
(*[, by_alias, ref_template])serialize_model
(handler)Do not serialize ref_coef_norm if it is unspecified (None).
serialize_ref_coef_norm
(ref_coef_norm)Convert list back to comma-separated string for serialization.
split_comma_separated_ref_coef_norm
(v)Convert comma-separated string to list for ref_coef_norm.
update_forward_refs
(**localns)validate
(value)validate_coefficient_count
(coefficients, info)Validate that coefficient count matches summand count appropriately.
validate_extended_matches_coefficients
(...)Validate that extended matches coefficient configuration.
validate_ref_coef_norm_usage
(ref_coef_norm, info)Validate that ref_coef_norm is only used with N=N coefficient case.
Attributes
constants
Dictionary of PyTensor constants generated from numeric field values.
model_computed_fields
model_config
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
model_extra
Get extra fields set during validation.
model_fields
model_fields_set
Returns the set of fields that have been explicitly set on this model instance.
parameters
Set of parameter names this component depends on.
type
summands
coefficients
extended
ref_coef_norm
name