ModelAdapter#

class causalpy.experiments.model_adapter.ModelAdapter[source]#

Experiment-agnostic wrapper around a CausalPy statistical backend.

Methods

ModelAdapter.build(X, y, *[, coords])

Construct the backend's graph/design state without sampling.

ModelAdapter.coefficients(*[, group])

Return model coefficients with canonical coefficient dimensions.

ModelAdapter.fit(X, y, *[, coords])

Fit the model with backend-appropriate conventions.

ModelAdapter.predict(X, *[, coords, ...])

Return expected outcomes with canonical prediction dimensions.

ModelAdapter.print_coefficients(labels[, ...])

Print model coefficients with labels.

ModelAdapter.require_idata()

Return fitted inference-result DataTree or raise an explicit capability error.

ModelAdapter.sample_posterior(**kwargs)

Sample the posterior phase with backend-appropriate conventions.

ModelAdapter.sample_prior_predictive(**kwargs)

Sample the prior predictive phase.

ModelAdapter.score(X, y, *[, coords])

Return per-unit \(R^2\) scores in the canonical container.

Attributes

has_posterior

Whether posterior draws are available on this backend.

has_prior

Whether prior draws are available on this backend.

idata

Return a fitted inference-result DataTree when supported, otherwise None.

is_bayesian

Whether the backend is Bayesian (PyMC or pymc-forecast).

is_built

Whether the backend's model graph / design state is constructed.

is_ols

Whether the backend is OLS/sklearn.

kind

Backend identifier.

model

The underlying model instance.

supports_idata

Whether the backend exposes an inference-result DataTree.

supports_prior_predictive

Whether this backend can sample a prior predictive phase.

__init__()#
classmethod __new__(*args, **kwargs)#