Skip to content

Commit d27aa89

Browse files
committed
make get_plot_data methods public, links to functions in docstrings, add arviz to intersphinx_mapping
1 parent 5eaaec4 commit d27aa89

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

causalpy/experiments/base.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,22 @@ def _ols_plot(self, *args, **kwargs):
8383
def get_plot_data(self, *args, **kwargs) -> pd.DataFrame:
8484
"""Recover the data of a PrePostFit experiment along with the prediction and causal impact information.
8585
86-
Internally, this function dispatches to either `_get_plot_data_bayesian` or `_get_plot_data_ols`
86+
Internally, this function dispatches to either :func:`get_plot_data_bayesian` or :func:`get_plot_data_ols`
8787
depending on the model type.
8888
"""
8989
if isinstance(self.model, PyMCModel):
90-
return self._get_plot_data_bayesian(*args, **kwargs)
90+
return self.get_plot_data_bayesian(*args, **kwargs)
9191
elif isinstance(self.model, RegressorMixin):
92-
return self._get_plot_data_ols(*args, **kwargs)
92+
return self.get_plot_data_ols(*args, **kwargs)
9393
else:
9494
raise ValueError("Unsupported model type")
9595

9696
@abstractmethod
97-
def _get_plot_data_bayesian(self, *args, **kwargs):
97+
def get_plot_data_bayesian(self, *args, **kwargs):
9898
"""Abstract method for recovering plot data."""
99-
raise NotImplementedError("_get_plot_data_bayesian method not yet implemented")
99+
raise NotImplementedError("get_plot_data_bayesian method not yet implemented")
100100

101101
@abstractmethod
102-
def _get_plot_data_ols(self, *args, **kwargs):
102+
def get_plot_data_ols(self, *args, **kwargs):
103103
"""Abstract method for recovering plot data."""
104-
raise NotImplementedError("_get_plot_data_ols method not yet implemented")
104+
raise NotImplementedError("get_plot_data_ols method not yet implemented")

causalpy/experiments/prepostfit.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,12 @@ def _ols_plot(self, round_to=None, **kwargs) -> tuple[plt.Figure, List[plt.Axes]
303303

304304
return (fig, ax)
305305

306-
def _get_plot_data_bayesian(self, hdi_prob: float = 0.94) -> pd.DataFrame:
306+
def get_plot_data_bayesian(self, hdi_prob: float = 0.94) -> pd.DataFrame:
307307
"""
308308
Recover the data of a PrePostFit experiment along with the prediction and causal impact information.
309+
310+
:param hdi_prob:
311+
Prob for which the highest density interval will be computed. The default value is defined as the default from the :func:`arviz.hdi` function.
309312
"""
310313
if isinstance(self.model, PyMCModel):
311314
hdi_pct = int(round(hdi_prob * 100))
@@ -350,7 +353,7 @@ def _get_plot_data_bayesian(self, hdi_prob: float = 0.94) -> pd.DataFrame:
350353
else:
351354
raise ValueError("Unsupported model type")
352355

353-
def _get_plot_data_ols(self) -> pd.DataFrame:
356+
def get_plot_data_ols(self) -> pd.DataFrame:
354357
"""
355358
Recover the data of a PrePostFit experiment along with the prediction and causal impact information.
356359
"""

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109

110110
# -- intersphinx config -------------------------------------------------------
111111
intersphinx_mapping = {
112+
"arviz": ("https://python.arviz.org/en/stable/", None),
112113
"examples": ("https://www.pymc.io/projects/examples/en/latest/", None),
113114
"mpl": ("https://matplotlib.org/stable", None),
114115
"numpy": ("https://numpy.org/doc/stable/", None),

0 commit comments

Comments
 (0)