mbi.estimation.Estimator
- class mbi.estimation.Estimator(*, marginal_oracle: MarginalOracle | None = None)[source]
Bases:
ABCAn object that estimates a Model from a marginal-based loss function.
Subclasses implement
_init,_step, and_finalize. The ABC provides a defaultestimateloop and a shared asynchronousprecompilethat works for any estimator with a jitted_step.State convention: the first element of the state tuple returned by
_init/_stepis the current solution (passed tocallback_fn). Override_callback_valueonly if the callback needs a transformation.- marginal_oracle
Callable for computing marginals from potentials. If
None, auto-selected viadefault_oracle().- Type:
- Examples of subclasses:
MirrorDescentDualAveragingInteriorGradientextensions.MixtureOfProductsEstimatorextensions.ReweightedDatasetEstimator
Methods
__init__Estimate a Model from noisy marginal measurements.
Warm up the JIT cache for
estimateasynchronously.Attributes
- marginal_oracle: MarginalOracle | None = None
- estimate(domain: Domain, loss_fn: MarginalLossFn | Sequence[LinearMeasurement], known_total: float | None = None, constraints: Sequence[Constraint] = (), iters: int = 1000, callback_fn: Callable | None = None, warm_start: Model | CliqueVector | None = None, tol: float | None = 0.001) Model[source]
Estimate a Model from noisy marginal measurements.
If
warm_startis provided, the estimator initializes from a previously estimated model instead of from scratch. For potential-based estimators the model’s potentials are expanded to cover any new cliques; for MixtureOfProducts the model is used directly.If
tolis set (default1e-3), optimization stops early once the normalized primal-dual gap falls at or belowtol. Passtol=Noneto disable early stopping and run the fulliters.
- precompile(domain: Domain, measurements: Sequence[LinearMeasurement] | None = None, *, extra_cliques: Sequence[tuple[str | int, ...]] | None = None, constraints: Sequence[Constraint] = ()) Future[source]
Warm up the JIT cache for
estimateasynchronously.Returns a
Futurethat completes when compilation finishes. Callers may ignore the return value (fire-and-forget) or callfuture.result()to block until compilation is done.