Pipeline#

class causalpy.pipeline.Pipeline[source]#

Orchestrate a sequence of causal-inference steps.

The pipeline validates all steps before executing any of them, ensuring configuration errors are caught before potentially expensive model fitting.

Parameters:
  • data (DataFrame) – The dataset to analyse.

  • steps (list[Step]) – Ordered sequence of pipeline steps.

Examples

>>> import causalpy as cp
>>> result = cp.Pipeline(
...     data=df,
...     steps=[
...         cp.EstimateEffect(
...             method=cp.InterruptedTimeSeries,
...             treatment_time=pd.Timestamp("2020-01-01"),
...             formula="y ~ 1 + t",
...             model=cp.pymc_models.LinearRegression(),
...         ),
...     ],
... ).run()

Methods

Pipeline.__init__(data, steps)

Pipeline.run()

Validate all steps, then execute them sequentially.

__init__(data, steps)[source]#
Parameters:
Return type:

None

classmethod __new__(*args, **kwargs)#