pymixef.backends package

Built-in SciPy/NumPy reference estimation backends.

class pymixef.backends.Backend(*args, **kwargs)[source]

Bases: Protocol

Protocol implemented by all estimation engines.

fit(data, **options)[source]

Fit a compiled numeric model and return the shared payload.

Parameters:
  • data (Any)

  • options (Any)

Return type:

dict[str, Any]

name: str
exception pymixef.backends.BackendError(message, *, code='BACKEND-001', details=None, suggested_engines=())[source]

Bases: PyMixEFError

A stable, machine-readable backend input or numerical error.

Parameters:
  • message (str)

  • code (str)

  • details (Mapping[str, Any] | None)

  • suggested_engines (Sequence[str])

Return type:

None

to_dict()[source]

Return a JSON-compatible diagnostic record.

Return type:

dict[str, Any]

exception pymixef.backends.BackendInputError(message, *, details=None)[source]

Bases: BackendError

The compiled numeric input is invalid.

Parameters:
  • message (str)

  • details (Mapping[str, Any] | None)

Return type:

None

exception pymixef.backends.BackendNumericalError(message, *, details=None)[source]

Bases: BackendError

A numerical calculation failed before a valid payload could be made.

Parameters:
  • message (str)

  • details (Mapping[str, Any] | None)

Return type:

None

exception pymixef.backends.BackendUnsupportedError(message, *, details=None, suggested_engines=())[source]

Bases: EngineCompatibilityError

The requested model is scientifically unsupported by this engine.

Parameters:
  • message (str)

  • details (Mapping[str, Any] | None)

  • suggested_engines (Sequence[str])

Return type:

None

to_dict()[source]

Return a JSON-compatible diagnostic record.

Return type:

dict[str, Any]

pymixef.backends.DenseLMMBackend

alias of GaussianLMMBackend

pymixef.backends.GLMMBackend

alias of LaplaceGLMMBackend

class pymixef.backends.GaussianLMMBackend[source]

Bases: object

Exact dense/reference Gaussian LMM engine.

fit(data, *, method=None, reml=None, maxiter=1_000, tolerance=1e-8, compute_hessian=True, **options)[source]
Parameters:
  • data (Any)

  • method (str | None)

  • reml (bool | None)

  • maxiter (int)

  • tolerance (float)

  • compute_hessian (bool)

  • options (Any)

Return type:

dict[str, Any]

name = 'lmm'
pymixef.backends.LMMBackend

alias of GaussianLMMBackend

class pymixef.backends.LaplaceGLMMBackend[source]

Bases: object

Dense grouped-random-effect Laplace GLMM reference backend.

fit(data, *, family=None, maxiter=500, tolerance=1e-7, inner_maxiter=100, inner_tolerance=1e-9, compute_hessian=True, **options)[source]
Parameters:
  • data (Any)

  • family (Any)

  • maxiter (int)

  • tolerance (float)

  • inner_maxiter (int)

  • inner_tolerance (float)

  • compute_hessian (bool)

  • options (Any)

Return type:

dict[str, Any]

name = 'laplace'
class pymixef.backends.MMRMBackend[source]

Bases: object

Dense subject-block MMRM REML engine.

fit(data, *, covariance=None, method='REML', df_method='satterthwaite', confidence_level=0.95, maxiter=1_000, tolerance=1e-8, compute_hessian=True, **options)[source]
Parameters:
  • data (Any)

  • covariance (Any)

  • method (str)

  • df_method (str)

  • confidence_level (float)

  • maxiter (int)

  • tolerance (float)

  • compute_hessian (bool)

  • options (Any)

Return type:

dict[str, Any]

name = 'mmrm'
pymixef.backends.fit_glmm(data, **options)[source]

Fit a supported GLMM by dense first-order Laplace approximation.

Parameters:
  • data (Any)

  • options (Any)

Return type:

dict[str, Any]

pymixef.backends.fit_lmm(data, **options)[source]

Fit a Gaussian LMM with the dense reference backend.

Parameters:
  • data (Any)

  • options (Any)

Return type:

dict[str, Any]

pymixef.backends.fit_mmrm(data, **options)[source]

Fit a Gaussian MMRM with dense subject covariance blocks.

Parameters:
  • data (Any)

  • options (Any)

Return type:

dict[str, Any]

pymixef.backends.get_backend(name)[source]

Instantiate a built-in backend by stable engine name.

Parameters:

name (str)

Return type:

Backend

pymixef.backends.validate_payload(payload)[source]

Validate the backend-neutral result contract and return canonical key order.

The validator is shared by built-in and third-party backends. It checks presence, numeric finiteness, observation alignment, covariance shape, convergence state, and container types without imposing an engine-specific parameterization.

Parameters:

payload (Mapping[str, Any])

Return type:

dict[str, Any]

Submodules