PyMCModelAdapter#

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

Adapter for PyMCModel backends.

Parameters:

model (PyMCModel) – Fitted or unfitted PyMC backend model.

Methods

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

Merge priors and construct the PyMC graph without sampling.

PyMCModelAdapter.coefficients(*[, group])

Return coefficient draws from the requested group, canonically.

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

Fit the PyMC model (build + prior phase + posterior phase).

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

Predict expected outcomes using the PyMC model.

PyMCModelAdapter.print_coefficients(labels)

Print model coefficients with labels.

PyMCModelAdapter.require_idata()

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

PyMCModelAdapter.sample_posterior(**kwargs)

Sample the posterior phase on the built graph.

PyMCModelAdapter.sample_prior_predictive(...)

Sample the prior predictive phase on the built graph.

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

Score predictions from the PyMC model.

Attributes

has_posterior

Whether posterior draws are available.

has_prior

Whether prior draws are available.

idata

Return the model's DataTree when fitted.

is_bayesian

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

is_built

Whether the PyMC graph has been constructed.

is_ols

Whether the backend is OLS/sklearn.

kind

Backend identifier.

model

The underlying PyMC model.

supports_idata

Whether the backend exposes an inference-result DataTree.

supports_prior_predictive

Whether the wrapped PyMC model exposes a prior predictive phase.

__init__(model)[source]#
Parameters:

model (PyMCModel)

Return type:

None

classmethod __new__(*args, **kwargs)#