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
604 stars 139 forks source link

Image comparison in test suite #355

Open wd60622 opened 11 months ago

wd60622 commented 11 months ago

In order to improve the tests for the clv plotting module, a comparison of image generated would confirm expected behavior.

Helpful resources might be matplotlib.testing module.

wd60622 commented 11 months ago

I'm understanding that this might look like having a saved off image that will be the expected results then comparing the code created image to this expected image. Might make use of the matplotlib.testing.compare.calculate_rms function found in the link above

wd60622 commented 6 months ago

Another option might be to use this matplotlib plugin to generate the reference images

https://github.com/matplotlib/pytest-mpl

wd60622 commented 4 months ago

Tried to bring in pytest-mpl in PR #456 but ended up removing as the images were not reproducing the same result in the CI/CD

We might want to use some of the configurations like no axis, no labels, relax comparison threshold, etc