Priors¶
Prior classes for adding prior probability distributions to objective functions.
Classes¶
- class ionworkspipeline.data_fits.objective_functions.regularizers.Prior(name: str | list[str] | ndarray | tuple, distribution: Distribution, regularizer_weight=None)¶
A function that takes a dictionary of inputs and returns a value.
Parameters¶
- funcallable
The penalty function that takes a dictionary of inputs and returns a value.
- regularizer_weightfloat, optional
The weight applied to the penalty term. Default is 1.0.
Extends:
ionworkspipeline.data_fits.objective_functions.regularizers.regularizers.Regularizer- evaluate_to_array(inputs: dict) ndarray¶
Evaluate the regularizer function with dictionary inputs, returning an array.
Parameters¶
- inputsdict
Dictionary of input values.
Returns¶
- ndarray
Array containing the regularizer value.
- evaluate_to_scalar(inputs: dict) float¶
Evaluate the regularizer function with dictionary inputs, returning a scalar. The scalar value evaluates the canonical form, which is \((w * f(x))^2\).
Parameters¶
- inputsdict
Dictionary of input values.
Returns¶
- float
Scalar regularizer value.
- classmethod from_schema(schema)¶
Construct from a validated
ionworks_schemaPrior.The nested
distributionis a schemaDistribution— the contract holds onlyionworks_schemaobjects, not runtime ones — so convert it to its runtime counterpart via the matching distribution’sfrom_schemabefore constructing the runtimePrior. The genericfrom_schemacan’t do this: itmodel_dumps the distribution to a dict, which__init__rejects.
- class ionworkspipeline.data_fits.objective_functions.regularizers.PriorSet(priors: list[Prior], x_to_inputs: callable, regularizer_set_weight=None)¶
A collection of prior terms that can be evaluated together.
Parameters¶
- priorslist[Prior]
Collection of prior terms.
- x_to_inputscallable
Function converting parameter vectors to input dictionaries.
- regularizer_set_weightfloat, optional
Weight applied to the entire prior set. Default is 1.0.
Extends:
ionworkspipeline.data_fits.objective_functions.regularizers.regularizers.RegularizerSet- property base_regularizer_type¶
type: The base type for regularizers in this set.