Skip to content

Commit

Permalink
update deprecation warnings for the scikit-learn experiment classes
Browse files Browse the repository at this point in the history
  • Loading branch information
drbenvincent committed Aug 20, 2024
1 parent 6f6fade commit 66f22aa
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions causalpy/skl_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@

# Ensure deprecation warnings are always shown in Jupyter Notebooks
warnings.simplefilter("always", DeprecationWarning)
RED = "\033[91m"
RESET = "\033[0m"


def SyntheticControl(*args, **kwargs):
warnings.warn(
"""causalpy.skl_experiments.SyntheticControl is deprecated and will be removed in a future release. Please use causalpy.experiments.SyntheticControl instead.""",
f"""{RED}cp.pymc_experiments.SyntheticControl is deprecated and will be removed in a future release. Please use:
import causalpy as cp
cp.SyntheticControl(...){RESET}""",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -49,7 +53,9 @@ def SyntheticControl(*args, **kwargs):

def DifferenceInDifferences(*args, **kwargs):
warnings.warn(
"""causalpy.skl_experiments.DifferenceInDifferences is deprecated and will be removed in a future release. Please use causalpy.experiments.DifferenceInDifferences instead.""",
f"""{RED}cp.pymc_experiments.DifferenceInDifferences is deprecated and will be removed in a future release. Please use:
import causalpy as cp
cp.DifferenceInDifferences(...){RESET}""",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -58,7 +64,9 @@ def DifferenceInDifferences(*args, **kwargs):

def InterruptedTimeSeries(*args, **kwargs):
warnings.warn(
"""causalpy.skl_experiments.InterruptedTimeSeries is deprecated and will be removed in a future release. Please use causalpy.experiments.InterruptedTimeSeries instead.""",
f"""{RED}cp.pymc_experiments.InterruptedTimeSeries is deprecated and will be removed in a future release. Please use:
import causalpy as cp
cp.InterruptedTimeSeries(...){RESET}""",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -67,7 +75,9 @@ def InterruptedTimeSeries(*args, **kwargs):

def RegressionDiscontinuity(*args, **kwargs):
warnings.warn(
"""causalpy.skl_experiments.RegressionDiscontinuity is deprecated and will be removed in a future release. Please use causalpy.experiments.RegressionDiscontinuity instead.""",
f"""{RED}cp.pymc_experiments.RegressionDiscontinuity is deprecated and will be removed in a future release. Please use:
import causalpy as cp
cp.RegressionDiscontinuity(...){RESET}""",
DeprecationWarning,
stacklevel=2,
)
Expand Down

0 comments on commit 66f22aa

Please sign in to comment.