pymc-labs / pymc-marketing

Bayesian marketing toolbox in PyMC. Media Mix (MMM), customer lifetime value (CLV), buy-till-you-die (BTYD) models and more.
https://www.pymc-marketing.io/
Apache License 2.0
705 stars 198 forks source link

`plot_curve` references wrong function in `sample_kwargs` description #1020

Closed wd60622 closed 1 month ago

wd60622 commented 2 months ago

https://www.pymc-marketing.io/en/latest/api/generated/pymc_marketing.mmm.plot.plot_curve.html#pymc_marketing.mmm.plot.plot_curve

References plot_curve instead of plot_samples

Ishaanjolly commented 1 month ago

Hi @wd60622 do you mean this:


import numpy as np
import pandas as pd

import pymc as pm

import matplotlib.pyplot as plt

from pymc_marketing.mmm.plot import plot_curve

seed = sum(map(ord, "Arbitrary curve"))
rng = np.random.default_rng(seed)

dates = pd.date_range("2024-01-01", periods=52, freq="W")

coords = {"date": dates, "product": ["A", "B"]}
with pm.Model(coords=coords) as model:
    data = pm.Normal(
        "data",
        mu=[-0.5, 0.5],
        sigma=1,
        dims=("date", "product"),
    )
    cumsum = pm.Deterministic(
        "cumsum",
        data.cumsum(axis=0),
        dims=("date", "product"),
    )
    idata = pm.sample_prior_predictive(random_seed=rng)

curve = idata.prior["cumsum"]

fig, axes = plot_curve(
    curve,
    non_grid_names={"date"},
    subplot_kwargs={"figsize": (15, 5)},
)
plt.show()

you want plot_sample instead of plot_curve?

wd60622 commented 1 month ago

In the docstring in the details for the sample_kwargs, the wrong function is referenced.

That example is fine

wd60622 commented 1 month ago

This is what is incorrect

wrong-function