ModelAdapter#

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

Experiment-agnostic wrapper around a CausalPy statistical backend.

Methods

ModelAdapter.coefficients()

Return point estimates of model coefficients.

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

Fit the model with backend-appropriate conventions.

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

Return expected outcomes with canonical prediction dimensions.

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

Print model coefficients with labels.

ModelAdapter.require_idata()

Return fitted InferenceData or raise an explicit capability error.

ModelAdapter.score(X, y, **kwargs)

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

Attributes

idata

Return InferenceData when supported and fitted, otherwise None.

is_bayesian

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

is_ols

Whether the backend is OLS/sklearn.

kind

Backend identifier.

model

The underlying model instance.

supports_idata

Whether the backend can expose ArviZ InferenceData.

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