pymc-devs / pymc-devs/pymc-examples

Unused prior in Bayesian AB testing case study

Open
#408 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
398
Forks
325
Avg merge
9d 15m
Merged PRs (30d)
1

Description

Notebook title: What is A/B testing?
Notebook url: https://github.com/pymc-devs/pymc-examples/blob/main/examples/case_studies/bayesian_ab_testing.ipynb

Issue description

In the RevenueModel class the converted object goes unused:

converted = pm.Binomial(
                "converted", n=visitors, p=theta, observed=purchased, shape=num_variants
            )
revenue = pm.Gamma(
                "revenue", alpha=purchased, beta=lam, observed=total_revenue, shape=num_variants
            )

The following line uses purchased (which is supposed to represent collected data) as alpha - I'm guessing that should be converted?

Expected output

I'm a beginner Bayesian, so I'm not sure if the output is unexpected or not.

Proposed solution

In a local copy of the code, I replaced purchased with converted + 1e-8 (plus a small epsilon) in the revenue prior, and the code ran pretty much the same as before.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open examples/case_studies/bayesian_ab_testing.ipynb and locate the RevenueModel class. Inspect how converted, purchased, and total_revenue are used, then run the notebook to compare the current behavior with any change. Done means resolving the unused converted object or documenting why the current revenue prior is correct, with the notebook still running successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.