/unfair-coin-bayes

Simulates the posterior distribution of the probability of an unfair coin

Primary LanguagePythonMIT LicenseMIT

Python GitHub release License: MIT CI codecov Language grade: Python Language grade: JavaScript

Unfair Coin Bayesian Simulation

This repository creates a web app that simulates the evolving probability distribution of an unfair coin to come up heads using Bayes's theorem. The prior distribution is a Beta distribution with both shape parameters set to one, resulting in a uniform distribution. This repository is ready to deploy a web application using Flask and Bokeh to services such as Render. An example of the app can be seen at here.

Prerequisites

You will need either Python 3.8 or 3.9. All required Python packages can be found in the requirements.txt file.

Running the app locally

You may want to run the app using Flask locally before deploying it to Heroku, especially if you have made any changes to the code. To run locally:

  1. clone the repository.
  2. in the repository, run make deploy-prod.
  3. open the link provided in the command line.

Alternatively, you can deploy using Docker. You can run using make docker-deploy or

  1. docker build -t unfair-coin-bayes .
  2. docker run --init --rm -d --publish 127.0.0.1:8000:8000 --env SECRET_KEY=$(bin/set-secret-key --) unfair-coin-bayes

License

This project is distributed under the MIT license. Please see LICENSE for more information.