Skip to content

Commit 80333ba

Browse files
Improve landing page (#1023)
* init * first complete iteration * more resources * intro sections * imprtove installing * add download stats * expand on installation * feedback * contributing * more resources * add gh cli * fix pre commit * fix placement * Update docs/source/index.md Co-authored-by: Christian Luhmann <[email protected]> * feedback 1 * center and remove support section which seems like a duplicate * feedback 2 * Update docs/source/index.md Co-authored-by: Christian Luhmann <[email protected]> * Update docs/source/index.md Co-authored-by: Christian Luhmann <[email protected]> * Update docs/source/index.md Co-authored-by: Christian Luhmann <[email protected]> * Update docs/source/index.md Co-authored-by: Christian Luhmann <[email protected]> * Update docs/source/index.md Co-authored-by: Christian Luhmann <[email protected]> * remove line * new line --------- Co-authored-by: Christian Luhmann <[email protected]>
1 parent d0070ca commit 80333ba

File tree

8 files changed

+348
-124
lines changed

8 files changed

+348
-124
lines changed

docs/source/contributing/index.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# Contributing
2+
3+
PyMC-Marketing welcomes contributions from interested individuals or groups. These guidelines are provided to give potential contributors information to make their contribution compliant with the conventions of the PyMC-Marketing project, and maximize the probability of such contributions to be merged as quickly and efficiently as possible. Contributors need not be experts, but should be interested in the project, willing to learn, and share knowledge.
4+
5+
There are 4 main ways of contributing to the PyMC-Marketing project (in ascending order of difficulty or scope):
6+
7+
1. Submitting issues related to bugs or desired enhancements.
8+
2. Contributing or improving the documentation (docs) or examples.
9+
3. Fixing outstanding issues (bugs) with the existing codebase. They range from low-level software bugs to higher-level design problems.
10+
4. Adding new or improved functionality to the existing codebase.
11+
12+
Items 2-4 require setting up a local development environment, see [Local development steps](#Contributing-code-via-pull-requests) for more information.
13+
14+
## Opening issues
15+
We appreciate being notified of problems with the existing PyMC-Marketing code. We prefer that issues be filed the on [Github Issue Tracker](https://github.com/pymc-labs/pymc-marketing/issues), rather than on social media or by direct email to the developers.
16+
17+
Please verify that your issue is not being currently addressed by other issues or pull requests by using the GitHub search tool to look for key words in the project issue tracker.
18+
19+
## Contributing code via pull requests
20+
21+
While issue reporting is valuable, we strongly encourage users who are inclined to do so to submit patches for new or existing issues via pull requests. This is particularly the case for simple fixes, such as typos or tweaks to documentation, which do not require a heavy investment of time and attention.
22+
23+
Contributors are also encouraged to contribute new code to enhance PyMC-Marketing's functionality, via pull requests.
24+
25+
The preferred workflow for contributing to PyMC-Marketing is to fork the GitHub repository, clone it to your local machine, and develop on a feature branch.
26+
27+
For more instructions see the [Pull request checklist](#pull-request-checklist)
28+
29+
## Local development steps
30+
31+
1. If you have not already done so, fork the [project repository](https://github.com/pymc-labs/pymc-marketing) by clicking on the 'Fork' button near the top right of the main repository page. This creates a copy of the code under your GitHub user account.
32+
33+
1. Clone your fork of the `pymc-marketing` repo from your GitHub account to your local disk, and add the base repository as a remote:
34+
35+
```bash
36+
git clone [email protected]:<your GitHub handle>/pymc-marketing.git
37+
cd pymc-marketing
38+
git remote add upstream [email protected]:pymc-labs/pymc-marketing.git
39+
```
40+
41+
Alternatively, if you use the [GitHub CLI](https://cli.github.com/), then the required command is just
42+
43+
```bash
44+
gh repo fork pymc-labs/pymc-marketing
45+
```
46+
47+
48+
1. Create a feature branch (e.g. `my-feature`) to hold your development changes:
49+
50+
```bash
51+
git checkout -b my-feature
52+
```
53+
54+
Always use a feature branch. It's good practice to never routinely work on the `main` branch of any repository.
55+
56+
1. Create a dedicated development environment from the file present in the repo:
57+
58+
```bash
59+
conda env create -f environment.yml
60+
```
61+
62+
This will create an environment called `pymc-marketing-dev`. Activate the environment.
63+
64+
```bash
65+
conda activate pymc-marketing-dev
66+
```
67+
68+
Install the package (in editable mode) and its development dependencies:
69+
70+
```bash
71+
make init
72+
```
73+
74+
Set [pre-commit hooks](https://pre-commit.com/). First install pre-commit package (either `pip install pre-commit`, see the package's installation instructions). Alternatively you can run `make check_lint` which will install the `pre-commit` package. Then run this to set up the git hook scripts:
75+
76+
```bash
77+
pre-commit install
78+
```
79+
80+
1. You can then work on your changes locally, in your feature branch. Add changed files using `git add` and then `git commit` files:
81+
82+
```bash
83+
git add modified_files
84+
git commit -m "Message summarizing commit changes"
85+
```
86+
87+
to record your changes locally.
88+
After committing, it is a good idea to sync with the base repository in case there have been any changes:
89+
90+
```bash
91+
git fetch upstream
92+
git rebase upstream/main
93+
```
94+
95+
Then push the changes to your GitHub account with:
96+
97+
```bash
98+
git push -u origin my-feature
99+
```
100+
101+
1. [Optionally] Build the docs locally. If you have changed any of the documentation, you can build it locally to check that it looks as expected.
102+
103+
```bash
104+
make html
105+
```
106+
107+
To delete all intermediate files and cached content and build the docs from scratch, run `make cleandocs` before `make html`
108+
109+
1. Before you submit a Pull request, follow the [Pull request checklist](#pull-request-checklist).
110+
111+
1. Finally, to submit a pull request, go to the GitHub web page of your fork of the PyMC-Marketing repo. Click the 'Pull request' button to send your changes to the project's maintainers for review. This will send an email to the committers.
112+
113+
## Pull request checklist
114+
115+
We recommend that your contribution complies with the following guidelines before you submit a pull request:
116+
117+
- If your pull request addresses an issue, please use the pull request title to describe the issue and mention the issue number in the pull request description. This will make sure a link back to the original issue is created.
118+
119+
- All public methods must have informative docstrings with sample usage when appropriate.
120+
121+
- To indicate a work in progress please mark the PR as `draft`. Drafts may be useful to (1) indicate you are working on something to avoid duplicated work, (2) request broad review of functionality or API, or (3) seek collaborators.
122+
123+
- All other tests pass when everything is rebuilt from scratch.
124+
125+
- When adding additional functionality, either edit an existing example, or create a new example (typically in the form of a Jupyter Notebook) in the `pymc-marketing/docs/source/mmm` or `pymc-marketing/docs/source/clv` folders. Have a look at other examples for reference. Examples should demonstrate why the new functionality is useful in practice.
126+
127+
- Documentation and high-coverage tests are necessary for enhancements to be accepted.
128+
129+
- Documentation follows [NumPy style guide](https://numpydoc.readthedocs.io/en/latest/format.html)
130+
131+
- Run any of the pre-existing examples in `pymc-marketing/docs/source/*` that contain analyses that would be affected by your changes to ensure that nothing breaks. This is a useful opportunity to not only check your work for bugs that might not be revealed by unit test, but also to show how your contribution improves PyMC-Marketing for end users.
132+
133+
- Your code passes linting tests. Run the line below to check linting errors:
134+
135+
```bash
136+
make check_lint
137+
```
138+
- If you want to fix linting errors automatically, run
139+
140+
```bash
141+
make lint
142+
```
143+
144+
- To run tests:
145+
146+
```bash
147+
make test
148+
```
149+
150+
- To check code style:
151+
152+
```bash
153+
make check_format
154+
```
155+
156+
- To fix code style automatically:
157+
158+
```bash
159+
make format
160+
```

docs/source/getting_started/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Getting Started
2+
3+
:::{toctree}
4+
:caption: Installation
5+
:maxdepth: 1
6+
7+
installation/index
8+
:::
9+
10+
:::{toctree}
11+
:caption: Quickstart
12+
:maxdepth: 1
13+
14+
quickstart/clv/index
15+
quickstart/mmm/index
16+
:::
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Installing PyMC-Marketing
2+
3+
PyMC-Marketing requires **Python 3.10 or greater**.
4+
5+
Install and activate an environment (e.g. `marketing_env`) with the `pymc-marketing` package from [conda-forge](https://conda-forge.org). It may look something like the following:
6+
7+
```bash
8+
conda create -c conda-forge -n marketing_env pymc-marketing
9+
conda activate marketing_env
10+
```
11+
12+
You can also install the development version of PyMC-Marketing with:
13+
14+
```bash
15+
pip install git+https://github.com/pymc-labs/pymc-marketing.git
16+
```
17+
18+
Next, we you can create a new Jupyter notebook with either JupyterLab or VS Code.
19+
20+
### JupyterLab Notebook
21+
22+
After installing the `pymc-marketing` package (see above), run the following with `marketing_env` activated:
23+
24+
```bash
25+
conda install -c conda-forge jupyterlab
26+
jupyter lab
27+
```
28+
29+
### VS Code Notebook
30+
31+
After installing the `pymc-marketing` package (see above), run the following with `marketing_env` activated:
32+
33+
```bash
34+
conda install -c conda-forge ipykernel
35+
```
36+
37+
Start VS Code and ensure that the "Jupyter" extension is installed. Press Ctrl + Shift + P and type "Python: Select Interpreter". Ensure that `marketing_env` is selected. Press Ctrl + Shift + P and type "Create: New Jupyter Notebook".
38+
39+
## Installation for developers
40+
41+
If you are a developer of pymc-marketing, or want to start contributing, [refer to the contributing guide](https://github.com/pymc-labs/pymc-marketing/blob/main/CONTRIBUTING.md) to get started.
42+
43+
See the official [PyMC installation guide](https://www.pymc.io/projects/docs/en/latest/installation.html) if more detail is needed.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# CLV Quickstart
2+
3+
We can choose from a variety of models, depending on the type of data and business nature. Let us look into a simple example with the Beta-Geo/NBD model for non-contractual continuous data.
4+
5+
```python
6+
import matplotlib.pyplot as plt
7+
import pandas as pd
8+
import seaborn as sns
9+
from pymc_marketing import clv
10+
11+
data_url = "https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/data/clv_quickstart.csv"
12+
data = pd.read_csv(data_url)
13+
data["customer_id"] = data.index
14+
15+
beta_geo_model = clv.BetaGeoModel(data=data)
16+
17+
beta_geo_model.fit()
18+
```
19+
20+
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.
21+
22+
See the {ref}`howto` section for more on this.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# MMM Quickstart
2+
3+
```python
4+
import pandas as pd
5+
6+
from pymc_marketing.mmm import (
7+
GeometricAdstock,
8+
LogisticSaturation,
9+
MMM,
10+
)
11+
12+
data_url = "https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/data/mmm_example.csv"
13+
data = pd.read_csv(data_url, parse_dates=["date_week"])
14+
15+
mmm = MMM(
16+
adstock=GeometricAdstock(l_max=8),
17+
saturation=LogisticSaturation(),
18+
date_column="date_week",
19+
channel_columns=["x1", "x2"],
20+
control_columns=[
21+
"event_1",
22+
"event_2",
23+
"t",
24+
],
25+
yearly_seasonality=2,
26+
)
27+
```
28+
29+
Once the model is fitted, we can further optimize our budget allocation as we are including diminishing returns and carry-over effects in our model.
30+
31+
Explore a hands-on [simulated example](https://pymc-marketing.readthedocs.io/en/stable/notebooks/mmm/mmm_example.html) for more insights into MMM with PyMC-Marketing.

docs/source/guide/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Guide
22

3+
Are you looking for introductory material on Marketing Mix Models or Customer Lifetime Value?
4+
This section provides a guide to the concepts and techniques used in PyMC-Marketing.
5+
36
:::{toctree}
47
:caption: Benefits of PyMC-Marketing
58
:maxdepth: 1

0 commit comments

Comments
 (0)