Skip to content

Add case study for Bayesian A/B Testing #164

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

Merged
merged 9 commits into from
Jun 5, 2021

Conversation

tcuongd
Copy link

@tcuongd tcuongd commented May 23, 2021

Description

Hi! I'd like to add a case study notebook to provide an introduction to A/B test analysis with Bayesian models. The models implemented are based on this paper. Super keen for feedback / whether or not you think this is useful to add to the examples directory.

If you guys find it interesting, I'm keen to write more notebooks to go into more complicated topics like early stopping of A/B tests, power analyses, and more complex models and priors. I think there's a lot of practical context here beyond the usual textbook examples that would be valuable to readers working in online software.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@twiecki
Copy link
Member

twiecki commented May 23, 2021

Thanks @tcuongd! Bayesian AB testing is a super common use case for pymc3 but so far there were no case studies so this is super relevant. Definitely interested in more in-depth stuff.

@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

ericmjl commented on 2021-05-24T01:51:15Z
----------------------------------------------------------------

It's probably a good idea to show the connection of A/B testing to traditional design of experiments. A/B testing is merely a fancy name for case vs. control experiment designs, where one of the groups, say "A", is the control group while the other ("B") is the case group; it's a staple experimental design in any of the experimental sciences (e.g. life sciences).


@ericmjl
Copy link
Member

ericmjl commented May 24, 2021

Nice stuff, @tcuongd 😄. Just one comment from me, above!

@tcuongd
Copy link
Author

tcuongd commented May 24, 2021

Thanks for the feedback guys :) I've changed the introduction to show a clearer link between A/B testing and controlled experiments.

I've also fixed some bugs with the revenue model example.

Thanks!

@review-notebook-app
Copy link

review-notebook-app bot commented May 25, 2021

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2021-05-25T09:49:39Z
----------------------------------------------------------------

Would it be worth it to also show this plot? Or do you plan to cover things related to this in another notebook? Having a link to the other notebook once it's added would be prefectly fine too. I think there should be at least a link because many readers of the notebook will probably not be too familiar with pymc (or Bayes either) and may not know what to do with this advise


tcuongd commented on 2021-05-25T13:08:41Z
----------------------------------------------------------------

Ah yes, good idea! I think we might as well show the plots here.

@OriolAbril
Copy link
Member

The notebook is great, and further notebooks on the topic would be amazing 🚀

Copy link
Author

tcuongd commented May 25, 2021

Ah yes, good idea! I think we might as well show the plots here.


View entire conversation on ReviewNB

@tcuongd
Copy link
Author

tcuongd commented May 25, 2021

@OriolAbril Could you please take another look? Thank you!

@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2021-05-25T16:20:10Z
----------------------------------------------------------------

How about plotting them side by side?

ax = az.plot_posterior(
    scenario_value_2, var_names=["theta_reluplift_1", "reciprocal_lam_reluplift_1"], textsize=10, kind="hist"
)
ax[0].set_title(f"Conversion Rate Uplift B, True Uplift = {(0.04 / 0.05 - 1):.2%}", fontsize=10)
ax[0].axvline(x=0, color="red")
ax[1].set_title(
    f"Revenue per Converting Visitor Uplift B, True Uplift = {(25 / 20 - 1):.2%}", fontsize=10
)
ax[1].axvline(x=0, color="red");

They would probably also benefit from a couple sentences restating how the model retrieves the less but larger purchases.


@tcuongd
Copy link
Author

tcuongd commented May 25, 2021

They would probably also benefit from a couple sentences restating how the model retrieves the less but larger purchases.

Ah side-by-side is a good idea, and I didn't know you could do that directly with az.plot_posterior, nice! I've made the changes :)

@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

OriolAbril commented on 2021-05-26T19:57:04Z
----------------------------------------------------------------

Line #12.    axs[1].axvline(x=0, color="red");

I would add a colon here to suppress the extra "lines" output


Copy link
Member

@OriolAbril OriolAbril left a comment

Choose a reason for hiding this comment

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

That last comment is a very minor nit. IMO, it can be merged right after it's fixed, everything else looks great

@tcuongd
Copy link
Author

tcuongd commented May 27, 2021

That last comment is a very minor nit. IMO, it can be merged right after it's fixed, everything else looks great

Thanks Oriol! Have fixed :)

@michaelosthege michaelosthege merged commit 1319dc7 into pymc-devs:main Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants