Skip to content

Commit 1630589

Browse files
pre-commit-ci[bot]juanitorduzJuan Orduz
authored
[pre-commit.ci] pre-commit autoupdate (#1313)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.3 → v0.8.4](astral-sh/ruff-pre-commit@v0.8.3...v0.8.4) - [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.14.0](pre-commit/mirrors-mypy@v1.13.0...v1.14.0) * remove precision numpy typing * minor fix * ignore error --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Juan Orduz <[email protected]> Co-authored-by: Juan Orduz <[email protected]>
1 parent f4fe828 commit 1630589

File tree

8 files changed

+1835
-1837
lines changed

8 files changed

+1835
-1837
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
- --exclude=docs/
1212
- --exclude=scripts/
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.8.3
14+
rev: v0.8.4
1515
hooks:
1616
- id: ruff
1717
types_or: [python, pyi, jupyter]
@@ -21,7 +21,7 @@ repos:
2121
types_or: [python, pyi, jupyter]
2222
exclude: ^docs/source/notebooks/clv/dev/
2323
- repo: https://github.com/pre-commit/mirrors-mypy
24-
rev: v1.13.0
24+
rev: v1.14.0
2525
hooks:
2626
- id: mypy
2727
args: [--ignore-missing-imports]

docs/source/notebooks/mmm/mmm_tvp_example.ipynb

Lines changed: 1814 additions & 1814 deletions
Large diffs are not rendered by default.

pymc_marketing/clv/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,14 @@ def rfm_summary(
379379
customers["frequency"] = customers["count"] - 1
380380

381381
customers["recency"] = (
382-
(pandas.to_datetime(customers["max"]) - pandas.to_datetime(customers["min"])) # type: ignore
383-
/ np.timedelta64(1, time_unit)
382+
(pandas.to_datetime(customers["max"]) - pandas.to_datetime(customers["min"]))
383+
/ np.timedelta64(1, time_unit) # type: ignore[call-overload]
384384
/ time_scaler
385385
)
386386

387387
customers["T"] = (
388388
(observation_period_end_ts - customers["min"])
389-
/ np.timedelta64(1, time_unit)
389+
/ np.timedelta64(1, time_unit) # type: ignore[call-overload]
390390
/ time_scaler
391391
)
392392

pymc_marketing/mmm/lift_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
Index = Sequence[int]
3434
Indices = dict[str, Index]
35-
Values = npt.NDArray[np.int_] | npt.NDArray[np.float64] | npt.NDArray[np.str_]
35+
Values = npt.NDArray[np.int_] | npt.NDArray | npt.NDArray[np.str_]
3636

3737

3838
def _find_unaligned_values(same_value: npt.NDArray[np.int_]) -> list[int]:

pymc_marketing/mmm/mmm.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,7 @@ def create_idata_attrs(self) -> dict[str, str]:
308308

309309
return attrs
310310

311-
def forward_pass(
312-
self, x: pt.TensorVariable | npt.NDArray[np.float64]
313-
) -> pt.TensorVariable:
311+
def forward_pass(self, x: pt.TensorVariable | npt.NDArray) -> pt.TensorVariable:
314312
"""Transform channel input into target contributions of each channel.
315313
316314
This method handles the ordering of the adstock and saturation
@@ -322,7 +320,7 @@ def forward_pass(
322320
323321
Parameters
324322
----------
325-
x : pt.TensorVariable | npt.NDArray[np.float64]
323+
x : pt.TensorVariable | npt.NDArray
326324
The channel input which could be spends or impressions
327325
328326
Returns
@@ -586,9 +584,9 @@ def default_model_config(self) -> dict:
586584

587585
def channel_contributions_forward_pass(
588586
self,
589-
channel_data: npt.NDArray[np.float64],
587+
channel_data: npt.NDArray,
590588
disable_logger_stdout: bool | None = False,
591-
) -> npt.NDArray[np.float64]:
589+
) -> npt.NDArray:
592590
"""Evaluate the channel contribution for a given channel data and a fitted model, ie. the forward pass.
593591
594592
Parameters
@@ -945,9 +943,9 @@ class MMM(
945943

946944
def channel_contributions_forward_pass(
947945
self,
948-
channel_data: npt.NDArray[np.float64],
946+
channel_data: npt.NDArray,
949947
disable_logger_stdout: bool | None = False,
950-
) -> npt.NDArray[np.float64]:
948+
) -> npt.NDArray:
951949
"""Evaluate the channel contribution for a given channel data and a fitted model, ie. the forward pass.
952950
953951
We return the contribution in the original scale of the target variable.

pymc_marketing/mmm/transformers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def weibull_adstock(
448448
return batched_convolution(x, w, axis=axis, mode=mode)
449449

450450

451-
def logistic_saturation(x, lam: npt.NDArray[np.float64] | float = 0.5):
451+
def logistic_saturation(x, lam: npt.NDArray | float = 0.5):
452452
r"""Logistic saturation transformation.
453453
454454
.. math::
@@ -492,7 +492,7 @@ def logistic_saturation(x, lam: npt.NDArray[np.float64] | float = 0.5):
492492

493493

494494
def inverse_scaled_logistic_saturation(
495-
x, lam: npt.NDArray[np.float64] | float = 0.5, eps: float = np.log(3)
495+
x, lam: npt.NDArray | float = 0.5, eps: float = np.log(3)
496496
):
497497
r"""Inverse scaled logistic saturation transformation.
498498
@@ -827,9 +827,9 @@ def tanh_saturation_baselined(
827827

828828

829829
def michaelis_menten(
830-
x: float | np.ndarray | npt.NDArray[np.float64],
831-
alpha: float | np.ndarray | npt.NDArray[np.float64],
832-
lam: float | np.ndarray | npt.NDArray[np.float64],
830+
x: float | np.ndarray | npt.NDArray,
831+
alpha: float | np.ndarray | npt.NDArray,
832+
lam: float | np.ndarray | npt.NDArray,
833833
) -> float | Any:
834834
r"""Evaluate the Michaelis-Menten function for given values of x, alpha, and lambda.
835835

pymc_marketing/mmm/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ def transform_1d_array(
9090

9191

9292
def sigmoid_saturation(
93-
x: float | np.ndarray | npt.NDArray[np.float64],
94-
alpha: float | np.ndarray | npt.NDArray[np.float64],
95-
lam: float | np.ndarray | npt.NDArray[np.float64],
93+
x: float | np.ndarray | npt.NDArray,
94+
alpha: float | np.ndarray | npt.NDArray,
95+
lam: float | np.ndarray | npt.NDArray,
9696
) -> float | Any:
9797
"""Sigmoid saturation function.
9898

pymc_marketing/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def random_samples(
298298
combinations = list(product(range(n_chains), range(n_draws)))
299299

300300
return [
301-
tuple(pair) for pair in rng.choice(combinations, size=n, replace=False).tolist()
301+
tuple(pair) for pair in list(rng.choice(combinations, size=n, replace=False))
302302
]
303303

304304

0 commit comments

Comments
 (0)