Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plot_expected_purchases_over_time function #1115

Merged
merged 20 commits into from
Oct 24, 2024

Conversation

ColtAllen
Copy link
Collaborator

@ColtAllen ColtAllen commented Oct 24, 2024

Description

This PR consolidates the plot_cumulative_transactions and plot_incremental_transactions functions from lifetimes into a single plotting function, which is very useful for model evaluation:

image

So useful in fact that when I added it to the Quickstart, it revealed a data discrepancy causing model bias! I left it in the notebook because I felt like it was a teachable moment, but at the same time we're showcasing this library with a skewed model. I'm curious to hear your thoughts on this.

I added plt.clf() to the plotting function to reset the pyplot object between plots, which is useful when logging multiple figures to MLflow. I also took the opportunity to make a few other revisions to the Quickstart, such as use of the Prior class in model configs and a watermark.

Related Issue

Checklist

Modules affected

  • MMM
  • CLV

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚: https://pymc-marketing--1115.org.readthedocs.build/en/1115/

@ColtAllen ColtAllen added docs Improvements or additions to documentation enhancement New feature or request CLV request discussion priority: medium plots labels Oct 24, 2024
@ColtAllen ColtAllen added this to the 0.11.0 milestone Oct 24, 2024
@ColtAllen ColtAllen self-assigned this Oct 24, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added the tests label Oct 24, 2024
ylabel: str = "Purchases",
ax: plt.Axes | None = None,
**kwargs,
):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the return type hint plt.Axes (or shall we return the Figure object instead?, we do this for the MMM plots)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All CLV plots return plt.Axes, but I do have some big plans coming up for this module, so we can leave it as-is for now.

Copy link
Collaborator

@juanitorduz juanitorduz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this type of diagnostic plots!

I left some suggestions :D

Copy link
Contributor

@wd60622 wd60622 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Just some comments on the verbiage

@juanitorduz juanitorduz merged commit e8a4e3b into pymc-labs:main Oct 24, 2024
13 checks passed
@juanitorduz
Copy link
Collaborator

Thanks @ColtAllen !

@ColtAllen ColtAllen deleted the cum_plotting branch October 25, 2024 21:04
@ColtAllen ColtAllen changed the title Add plot_expected_purchases function Add plot_expected_purchases_over_time function Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLV docs Improvements or additions to documentation enhancement New feature or request plots priority: medium request discussion tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants