pymixef.backends package¶
Built-in SciPy/NumPy reference estimation backends.
- class pymixef.backends.Backend(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol 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:
PyMixEFErrorA 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
- exception pymixef.backends.BackendInputError(message, *, details=None)[source]¶
Bases:
BackendErrorThe 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:
BackendErrorA 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:
EngineCompatibilityErrorThe requested model is scientifically unsupported by this engine.
- Parameters:
message (str)
details (Mapping[str, Any] | None)
suggested_engines (Sequence[str])
- Return type:
None
- pymixef.backends.DenseLMMBackend¶
alias of
GaussianLMMBackend
- pymixef.backends.GLMMBackend¶
alias of
LaplaceGLMMBackend
- class pymixef.backends.GaussianLMMBackend[source]¶
Bases:
objectExact 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:
objectDense 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:
objectDense 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:
- 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¶
- pymixef.backends.base module
BackendBackendErrorBackendInputErrorBackendNumericalErrorBackendUnsupportedErrorCompiledDataCompiledData.sourceCompiledData.yCompiledData.XCompiledData.fixed_namesCompiledData.random_blocksCompiledData.offsetCompiledData.weightsCompiledData.trialsCompiledData.residual_covarianceCompiledData.residual_covariance_fixedCompiledData.n_obsCompiledData.n_fixedCompiledData.random_design
CovarianceParameterizationRandomBlockDataRandomBlockData.nameRandomBlockData.row_designRandomBlockData.designRandomBlockData.group_codesRandomBlockData.group_levelsRandomBlockData.term_namesRandomBlockData.correlatedRandomBlockData.terms_per_groupRandomBlockData.n_groupsRandomBlockData.coefficient_countRandomBlockData.coefficient_labels()
backend_mapping()cho_solve()convergence_mapping()covariance_from_hessian()covariance_slices()factorize()field()finite_gradient()finite_hessian()logdet_from_cholesky()make_payload()optimizer_covariance()prepare_data()prepare_random_block()random_covariance()safe_cholesky()select_optimizer_result()validate_payload()
- pymixef.backends.glmm module
- pymixef.backends.lmm module
- pymixef.backends.mmrm module