Skip to content

Commit

Permalink
feat(mmm): Replace ValueError with UserWarning for negative values
Browse files Browse the repository at this point in the history
  • Loading branch information
louismagowan committed Oct 23, 2024
1 parent 3f991d6 commit 6e5f622
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pymc_marketing/mmm/validating.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""Validating methods for MMM classes."""

from collections.abc import Callable
from warnings import warn

import pandas as pd

Expand Down Expand Up @@ -116,8 +117,10 @@ def validate_channel_columns(self, data: pd.DataFrame) -> None:
f"channel_columns {self.channel_columns} contains duplicates"
)
if (data.filter(list(self.channel_columns)) < 0).any().any():
raise ValueError(
f"channel_columns {self.channel_columns} contains negative values"
warn(
f"channel_columns {self.channel_columns} contains negative values",
UserWarning,
stacklevel=2,
)


Expand Down

0 comments on commit 6e5f622

Please sign in to comment.