PyMCForecastAdapter#
- class causalpy.experiments.model_adapter.PyMCForecastAdapter[source]#
Adapter for
PyMCForecastModelbackends.The wrapped model already speaks CausalPy’s Bayesian conventions (
mu/y_hatposterior-predictive output onobs_ind/treated_unitscoords), so this adapter is pure delegation.- Parameters:
model (
PyMCForecastModel) – Wrappedpymc_forecastbackend model.
Methods
PyMCForecastAdapter.build(X, y, *[, coords])Record the fit inputs for
sample_posterior().PyMCForecastAdapter.coefficients(*[, group])Forecasting models have no design-matrix coefficients.
PyMCForecastAdapter.fit(X, y, *[, coords])Fit the forecasting model on the pre-period.
PyMCForecastAdapter.predict(X, *[, coords, ...])Predict in-sample or forecast the counterfactual.
Print posterior summaries of the model's scalar parameters.
Return fitted inference-result DataTree or raise an explicit capability error.
PyMCForecastAdapter.sample_posterior(**kwargs)Fit the forecaster on the recorded inputs.
Raise: the forecaster exposes no prior-drawing path upstream.
PyMCForecastAdapter.score(X, y, *[, coords])Score in-sample predictions with the Bayesian \(R^2\).
Attributes
has_posteriorWhether posterior draws are available.
has_priorWhether prior draws are available on this backend.
idataReturn the model's DataTree when fitted.
is_bayesianWhether the backend is Bayesian (PyMC or pymc-forecast).
is_builtWhether fit inputs have been recorded via
build().is_olsWhether the backend is OLS/sklearn.
kindBackend identifier.
modelThe underlying pymc-forecast wrapper.
supports_idataWhether the backend exposes an inference-result DataTree.
supports_prior_predictiveWhether this backend can sample a prior predictive phase.
- __init__(model)[source]#
- Parameters:
model (PyMCForecastModel)
- Return type:
None
- classmethod __new__(*args, **kwargs)#