mixle.inference.create module

Certified model creation from data.

create fits a model through the ordinary Mixle inference machinery and returns a CreatedModel artifact rather than a bare distribution. The artifact contains the fitted model, an estimation certificate, optional calibration, optional uncertainty quantification, and provenance.

The budget and device arguments are recorded as constraints and bias the automatic structure search toward smaller, independence-first models. They do not replace task-specific compression or edge-distillation workflows; they make the creation boundary explicit when a caller already knows the deployment envelope.

class CreatedModel(model, certificate, strategy, calibration=None, uq=None, provenance=<factory>, postconditions=<factory>)[source]

Bases: object

A certified model artifact: the fitted model plus its guarantees and provenance.

postconditions records every post-fit condition the caller asked for and what became of it: {"calibration": {"requested": True, "performed": False, "error": "..."}, ...}. A requested postcondition that raised used to be replaced by a bare None field, so an artifact whose calibration and UQ had both failed was indistinguishable from one where neither was asked for – while still advertising the estimation certificate’s guarantee.

Parameters:
failed_postconditions()[source]

Names of the postconditions the caller requested that did not complete.

Return type:

list[str]

is_certified()[source]

Whether every requested postcondition actually completed.

The estimation certificate alone does not make an artifact certified: a caller who asked for calibration or UQ asked for it as part of the claim, so a silent failure invalidates the aggregate claim even though the fit itself succeeded.

Return type:

bool

property guarantee: Any

The aggregate estimation guarantee (MIN over blocks) – the artifact’s summary claim.

Reports Guarantee.UNVERIFIED when a requested postcondition failed: the artifact cannot expose a guarantee stronger than the weakest condition it was asked to establish.

why()[source]

One line summarizing how the artifact was estimated.

Return type:

str

is_calibrated()[source]

Whether the calibration holdout judged the model calibrated.

None means calibration was never requested. A requested calibration that failed is False, not None – the check was asked for and did not pass, which is a different statement from never having asked.

Return type:

bool | None

create(data, *, budget=None, device=None, calibrate=None, quantify_uq=False, max_its=25, seed=0)[source]

Create a certified model from data (see module docstring).

data is a list of records/scalars. calibrate (a fraction in (0,1)) reserves a holdout for a PIT calibration check. quantify_uq=True attaches an auto-selected UQ handle. budget / device (any object; recorded verbatim) constrain the fit toward a smaller model. Returns a CreatedModel bundling the fit, its certificate, and the requested post-conditions.

Parameters:
  • data (Any)

  • budget (Any | None)

  • device (Any | None)

  • calibrate (float | None)

  • quantify_uq (bool)

  • max_its (int)

  • seed (int)

Return type:

CreatedModel