Skip to content

Commit a87f1fa

Browse files
authored
Add Example Gallery (#1611)
* This is a combination of 3 commits. init fix galery layout lower case * generate images on the go * This is a combination of 5 commits. delete images from repo try fix error try gix error try fix error update git ignore * re add images * undo file removal * try rm images again * rm extra req * better name * rtd reqs * rtd reqs * rtd reqs * undo * undo makefile * feedback * rm how to
1 parent 5e92892 commit a87f1fa

File tree

11 files changed

+615
-68
lines changed

11 files changed

+615
-68
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,6 @@ dmypy.json
142142

143143
# PyCharm .idea files
144144
.idea/
145+
146+
# Gallery images
147+
docs/source/gallery/images/

.readthedocs.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
version: 2
44

55
sphinx:
6-
configuration: docs/source/conf.py
6+
configuration: docs/source/conf.py
77

88
build:
99
os: ubuntu-22.04
1010
tools:
1111
python: "3.10"
12+
jobs:
13+
pre_build:
14+
# Install core dependencies first
15+
- pip install --upgrade pip setuptools wheel
16+
- python scripts/generate_gallery.py
1217

1318
python:
14-
install:
15-
- method: pip
16-
path: .
17-
extra_requirements:
18-
- docs
19+
install:
20+
- method: pip
21+
path: .
22+
extra_requirements:
23+
- docs

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ test: ## Install test dependencies and run tests
3737

3838
html: ## Install documentation dependencies and build HTML docs
3939
pip install .[docs]
40+
python scripts/generate_gallery.py
4041
sphinx-build docs/source docs/build -b html
4142

4243
cleandocs: ## Clean the documentation build directories

docs/source/gallery/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# PyMC-Marketing Example Gallery
2+
3+
This directory contains the gallery view for the PyMC-Marketing example notebooks.
4+
5+
## Gallery Structure
6+
7+
The gallery displays thumbnails and links to all example notebooks, organized by category.
8+
9+
## Adding New Examples to the Gallery
10+
11+
When adding new example notebooks:
12+
13+
1. Add the notebook to the appropriate directory in `docs/source/notebooks/`
14+
2. Update the gallery entry in `gallery.md`
15+
3. Create a thumbnail image for the notebook (ideally a screenshot of a key visualization from the notebook) and place it in the `images/` directory
16+
4. Run `python create_gallery_images.py` to generate a placeholder thumbnail if you don't have a specific image
17+
18+
## Gallery Images
19+
20+
The gallery uses thumbnail images to provide visual navigation. For best results:
21+
22+
- Images should be in PNG format
23+
- Images should have a 4:3 aspect ratio
24+
- Size should be approximately 600x450 pixels
25+
- Names should match the notebook filename
26+
27+
## Updating the Gallery
28+
29+
The gallery is structured using the Sphinx Design extension's grid layout. See the [Sphinx Design documentation](https://sphinx-design.readthedocs.io/en/latest/grids.html) for more information on customizing the grid layout.

docs/source/gallery/gallery.md

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
(gallery)=
2+
# Example Gallery
3+
4+
```{toctree}
5+
:hidden:
6+
```
7+
8+
## Introduction
9+
10+
Welcome to the PyMC-Marketing example gallery! This gallery provides visual navigation to all of our example notebooks to help you quickly find the techniques and models relevant to your marketing analytics needs.
11+
12+
## Marketing Mix Models (MMM)
13+
14+
### Fundamentals
15+
16+
::::{grid} 1 2 3 3
17+
:gutter: 3
18+
19+
:::{grid-item-card} MMM Example Notebook
20+
:img-top: ../gallery/images/mmm_example.png
21+
:link: ../notebooks/mmm/mmm_example.html
22+
:::
23+
24+
:::{grid-item-card} Custom Models with MMM components
25+
:img-top: ../gallery/images/mmm_components.png
26+
:link: ../notebooks/mmm/mmm_components.html
27+
:::
28+
29+
:::{grid-item-card} MMM Multidimensional Example Notebook (e.g. Geo-MMM)
30+
:img-top: ../gallery/images/mmm_multidimensional_example.png
31+
:link: ../notebooks/mmm/mmm_multidimensional_example.html
32+
:::
33+
::::
34+
35+
### Budget Allocation
36+
37+
::::{grid} 1 2 3 3
38+
:gutter: 3
39+
40+
:::{grid-item-card} Budget Allocation Example
41+
:img-top: ../gallery/images/mmm_budget_allocation_example.png
42+
:link: ../notebooks/mmm/mmm_budget_allocation_example.html
43+
:::
44+
45+
:::{grid-item-card} Budget Allocation Risk Assessment
46+
:img-top: ../gallery/images/mmm_allocation_assessment.png
47+
:link: ../notebooks/mmm/mmm_allocation_assessment.html
48+
:::
49+
::::
50+
51+
### Lift Test Calibration
52+
53+
::::{grid} 1 2 3 3
54+
:gutter: 3
55+
56+
:::{grid-item-card} Lift Test Analysis
57+
:img-top: ../gallery/images/mmm_lift_test.png
58+
:link: ../notebooks/mmm/mmm_lift_test.html
59+
:::
60+
61+
:::{grid-item-card} Case Study: Unobserved Confounders, ROAS and Lift Tests
62+
:img-top: ../gallery/images/mmm_roas.png
63+
:link: ../notebooks/mmm/mmm_roas.html
64+
:::
65+
::::
66+
67+
### Time-Varying Parameters
68+
69+
::::{grid} 1 2 3 3
70+
:gutter: 3
71+
72+
:::{grid-item-card} MMM with time-varying parameters
73+
:img-top: ../gallery/images/mmm_tvp_example.png
74+
:link: ../notebooks/mmm/mmm_tvp_example.html
75+
:::
76+
77+
:::{grid-item-card} MMM with time-varying media baseline
78+
:img-top: ../gallery/images/mmm_time_varying_media_example.png
79+
:link: ../notebooks/mmm/mmm_time_varying_media_example.html
80+
:::
81+
::::
82+
83+
### Model Evaluation
84+
85+
::::{grid} 1 2 3 3
86+
:gutter: 3
87+
88+
:::{grid-item-card} Cross-Validation
89+
:img-top: ../gallery/images/mmm_time_slice_cross_validation.png
90+
:link: ../notebooks/mmm/mmm_time_slice_cross_validation.html
91+
:::
92+
93+
:::{grid-item-card} Model Evaluation
94+
:img-top: ../gallery/images/mmm_evaluation.png
95+
:link: ../notebooks/mmm/mmm_evaluation.html
96+
:::
97+
::::
98+
99+
### Causal Inference
100+
101+
::::{grid} 1 2 3 3
102+
:gutter: 3
103+
104+
:::{grid-item-card} Causal Identification
105+
:img-top: ../gallery/images/mmm_causal_identification.png
106+
:link: ../notebooks/mmm/mmm_causal_identification.html
107+
:::
108+
109+
:::{grid-item-card} MMMs and Pearl's ladder of causal inference
110+
:img-top: ../gallery/images/mmm_counterfactuals.png
111+
:link: ../notebooks/mmm/mmm_counterfactuals.html
112+
:::
113+
::::
114+
115+
### Case Studies
116+
117+
::::{grid} 1 2 3 3
118+
:gutter: 3
119+
120+
:::{grid-item-card} MMM Case Study
121+
:img-top: ../gallery/images/mmm_case_study.png
122+
:link: ../notebooks/mmm/mmm_case_study.html
123+
:::
124+
::::
125+
126+
## Customer Lifetime Value (CLV) Models
127+
128+
::::{grid} 1 2 3 3
129+
:gutter: 3
130+
131+
:::{grid-item-card} CLV Quickstart
132+
:img-top: ../gallery/images/clv_quickstart.png
133+
:link: ../notebooks/clv/clv_quickstart.html
134+
:::
135+
136+
:::{grid-item-card} BG/NBD Model
137+
:img-top: ../gallery/images/bg_nbd.png
138+
:link: ../notebooks/clv/bg_nbd.html
139+
:::
140+
141+
:::{grid-item-card} MBG/NBD Model
142+
:img-top: ../gallery/images/mbg_nbd.png
143+
:link: ../notebooks/clv/mbg_nbd.html
144+
:::
145+
146+
:::{grid-item-card} Pareto/NBD Model
147+
:img-top: ../gallery/images/pareto_nbd.png
148+
:link: ../notebooks/clv/pareto_nbd.html
149+
:::
150+
151+
:::{grid-item-card} Gamma-Gamma Model
152+
:img-top: ../gallery/images/gamma_gamma.png
153+
:link: ../notebooks/clv/gamma_gamma.html
154+
:::
155+
156+
:::{grid-item-card} sBG Model
157+
:img-top: ../gallery/images/sBG.png
158+
:link: ../notebooks/clv/sBG.html
159+
:::
160+
::::
161+
162+
## Customer Choice Models
163+
164+
::::{grid} 1 2 3 3
165+
:gutter: 3
166+
167+
:::{grid-item-card} MV-ITS Saturated
168+
:img-top: ../gallery/images/mv_its_saturated.png
169+
:link: ../notebooks/customer_choice/mv_its_saturated.html
170+
:::
171+
172+
:::{grid-item-card} MV-ITS Unsaturated
173+
:img-top: ../gallery/images/mv_its_unsaturated.png
174+
:link: ../notebooks/customer_choice/mv_its_unsaturated.html
175+
:::
176+
::::
177+
178+
## General Tutorials
179+
180+
::::{grid} 1 2 3 3
181+
:gutter: 3
182+
183+
:::{grid-item-card} Model Configuration
184+
:img-top: ../gallery/images/model_configuration.png
185+
:link: ../notebooks/general/model_configuration.html
186+
:::
187+
188+
:::{grid-item-card} Prior Predictive Checks
189+
:img-top: ../gallery/images/prior_predictive.png
190+
:link: ../notebooks/general/prior_predictive.html
191+
:::
192+
193+
:::{grid-item-card} NUTS Samplers
194+
:img-top: ../gallery/images/other_nuts_samplers.png
195+
:link: ../notebooks/general/other_nuts_samplers.html
196+
:::
197+
::::

docs/source/getting_started/quickstart/clv/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ beta_geo_model.fit()
1919

2020
Once fitted, we can use the model to predict the number of future purchases for known customers, the probability that they are still alive, and get various visualizations plotted.
2121

22-
See the {ref}`howto` section for more on this.
22+
See the {ref}`gallery` section for more on this.

docs/source/getting_started/quickstart/customer_choice/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ model.sample(data[["competitor", "own"]], data["new"])
3838
model.plot_fit();
3939
```
4040

41-
See the {ref}`howto` section for more information about using the customer choice module.
41+
See the {ref}`gallery` section for more information about using the customer choice module.

docs/source/index.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,33 @@ We provide the following professional services:
5555

5656
## Quick links
5757

58-
:::::{grid} 1 1 2 2
58+
:::::{grid} 1 1 2 3
5959
:gutter: 2
6060

61+
::::{grid-item-card} Example Gallery
62+
:class-header: sd-text-center no-border
63+
:class-title: sd-text-center
64+
:class-footer: no-border
65+
66+
{material-outlined}`photo_library;5em`
67+
^^^^^^^^^^^^^^^
68+
69+
Browse our visual gallery of example notebooks to quickly
70+
find the techniques and models relevant to your
71+
marketing analytics needs.
72+
73+
+++
74+
75+
:::{button-ref} gallery/gallery
76+
:expand:
77+
:color: secondary
78+
:click-parent:
79+
:ref-type: doc
80+
81+
To the example gallery
82+
:::
83+
::::
84+
6185
::::{grid-item-card} Example notebooks
6286
:class-header: sd-text-center no-border
6387
:class-title: sd-text-center
@@ -110,7 +134,7 @@ To the reference guide
110134

111135
## Bayesian Marketing Mix Modeling (MMM) in PyMC
112136

113-
Leverage our Bayesian MMM API to tailor your marketing strategies effectively. Leveraging on top of the research article [Jin, Yuxue, et al. Bayesian methods for media mix modeling with carryover and shape effects. (2017)](https://research.google/pubs/pub46001/), and extending it by integrating the expertise from core PyMC developers, our API provides:
137+
Leverage our Bayesian MMM API to tailor your marketing strategies effectively. Leveraging on top of the research article [Jin, Yuxue, et al. "Bayesian methods for media mix modeling with carryover and shape effects." (2017)](https://research.google/pubs/pub46001/), and extending it by integrating the expertise from core PyMC developers, our API provides:
114138

115139
| Feature | Benefit |
116140
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -207,5 +231,6 @@ getting_started/index
207231
contributing/index
208232
guide/index
209233
api/index
234+
gallery/gallery
210235
notebooks/index
211236
:::

docs/source/notebooks/index.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)