Skip to content

docs(bass): update notebook to the BassModel workflow#2630

Draft
anevolbap wants to merge 7 commits into
pymc-labs:mainfrom
anevolbap:feat/2590-bass-notebook
Draft

docs(bass): update notebook to the BassModel workflow#2630
anevolbap wants to merge 7 commits into
pymc-labs:mainfrom
anevolbap:feat/2590-bass-notebook

Conversation

@anevolbap

@anevolbap anevolbap commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Related Issue

Description

Rewrites bass_example.ipynb around the BassModel class: model.fit with model_config/sampler_config, the plot_* methods from #2628 (plot_decomposition uses the dual y-axes asked for in #1706), out-of-sample forecasting, a save/load round-trip, and MLflow autologging from #2624. create_bass_model stays in the simulation section as the lower-level API.

Writing the notebook surfaced two bugs, fixed here with regression tests:

  • BassModel.load returned plain dicts instead of Prior objects, so any loaded model crashed. Fixed with parse_model_config in __init__ plus a serialization round-trip for Scaled priors.
  • Multi-product forecasting without observed data failed on a 1-D y_obs placeholder.

The notebook runs top to bottom with real sampling and passes the mocked CI runner. Stacked on #2624 and #2628; merging those first and rebasing shrinks this diff to the notebook plus the two fixes.

Checklist

  • Checked that the pre-commit linting/style checks pass
  • Included tests that prove the fix is effective or that the new feature works
  • Added necessary documentation (docstrings and/or example notebooks) using numpydoc format

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

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions Bot added docs Improvements or additions to documentation tests mlflow Bass model Dealing with the Bass Defusion model enhancement New feature or request labels Jun 12, 2026
@williambdean

Copy link
Copy Markdown
Contributor

We will have to imediately port with pymc 6.0.0. Can we pause?

BassModel.load left model_config as plain dicts after the JSON round-trip,
so build_model crashed on any loaded model. Parse the config in __init__
like CLV does, and register Scaled in the TypeRegistry so the scaled
market-potential prior round-trips too.
_data_setter filled y_obs with 1-D zeros, so out-of-sample prediction
failed for multi-product models.
@anevolbap anevolbap force-pushed the feat/2590-bass-notebook branch from b3eb0f4 to 2bb08e5 Compare June 12, 2026 20:43
@anevolbap

Copy link
Copy Markdown
Contributor Author

Sure, pausing this one. Should #2624 and #2628 wait too, or can those be reviewed on pymc 5.x? I will re-run the notebook once the 6.0.0 port lands.

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.18699% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.25%. Comparing base (649547e) to head (2bb08e5).

Files with missing lines Patch % Lines
pymc_marketing/bass/plotting.py 98.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2630      +/-   ##
==========================================
+ Coverage   94.19%   94.25%   +0.06%     
==========================================
  Files         100      101       +1     
  Lines       15384    15505     +121     
==========================================
+ Hits        14491    14615     +124     
+ Misses        893      890       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bass model Dealing with the Bass Defusion model docs Improvements or additions to documentation enhancement New feature or request mlflow tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Bass notebook to use BassModel class Dual y-axes for the "Innovators vs Imitators" plots in bass notebook

2 participants