|
4 | 4 | 
|
5 | 5 | [](https://github.com/psf/black)
|
6 | 6 |
|
7 |
| -> **Warning** |
8 |
| -> We're making a major breaking change in the project to use the [bayesian-testing](https://github.com/Matt52/bayesian-testing) library for better experiment management, and a full stack application will be developed to build a website for Janus. |
9 |
| -> Please, consider using the distributed [package in pypi](https://pypi.org/project/janus-web-ab-testing/), which comes from the `evolve-janus-backend` branch. |
| 7 | +Janus is a Bayesian A/B Testing application that supports multivariant experiments. It's designed to help you make data-driven decisions by analyzing conversion rates, revenue, and ARPU (Average Revenue Per User) across multiple variants. |
10 | 8 |
|
| 9 | +## Features |
11 | 10 |
|
12 |
| -Janus is an A/B Test Engine to be used in a variety use cases, especially to measure conversion, ticket and ARPU difference between variants, i.e, typical metrics for tests in marketplaces. The engine name is an analogy to _Janus_, the god of changes and transitions. |
13 |
| - |
14 |
| -This library came as an ideia of separate the statistical calculations in A/B Tests from other code that is typically used to manage tests and execute queries over the company's database, and hence usually carry proprietary code and even business logic, which should not be open sourced. There was the bud to build this library and get it open sourced. |
15 |
| - |
16 |
| -Checkout the [streamlit app](https://lgabs-janus-homepage-31diny.streamlit.app/) from this repo. |
| 11 | +- **Multivariant Testing**: Compare multiple variants simultaneously (not just A vs B) |
| 12 | +- **Bayesian Statistics**: Get more insightful results faster than traditional frequentist methods |
| 13 | +- **Key Metrics Analysis**: |
| 14 | + - Conversion rate |
| 15 | + - Revenue for conversions |
| 16 | + - Average revenue per impression (ARPU) |
| 17 | +- **Modern Web Interface**: Clean, responsive UI built with Bootstrap |
| 18 | +- **FastAPI Backend**: High-performance API for experiment analysis |
17 | 19 |
|
18 | 20 | ## Installation
|
19 | 21 |
|
20 |
| -Open a terminal, clone this repository into your machine and stay into the project directory. |
21 |
| - |
22 |
| -Using a virtual environment is a good practice, but it is optional. If you enjoy it, go ahead and create a virtual environment by typing: |
23 |
| -``` |
24 |
| -python3 -m venv venv -r requirements.txt |
25 |
| -``` |
26 |
| -Once it is created, you must now activate the environment by using: |
27 |
| -``` |
28 |
| -source venv/bin/activate |
| 22 | +1. Clone this repository: |
| 23 | +```bash |
| 24 | +git clone https://github.com/lgabs/janus.git |
| 25 | +cd janus |
29 | 26 | ```
|
30 |
| -Now, you can install our lib (if you are not using virtual env, go straight to this command): |
| 27 | + |
| 28 | +2. Create a virtual environment (optional but recommended): |
| 29 | +```bash |
| 30 | +python -m venv venv |
| 31 | +source venv/bin/activate # On Windows: venv\Scripts\activate |
31 | 32 | ```
|
32 |
| -make install |
| 33 | + |
| 34 | +3. Install dependencies: |
| 35 | +```bash |
| 36 | +pip install -r requirements.txt |
33 | 37 | ```
|
34 | 38 |
|
35 |
| -And that's it! Now, inside our environment, we can import the `janus` lib inside our scripts with plain `import janus` etc. Try to test using the same code on `experiment_example.ipynb` notebook here or in a plain terminal. |
| 39 | +## Running the Application |
| 40 | + |
| 41 | +### Using Python directly: |
| 42 | + |
| 43 | +```bash |
| 44 | +uvicorn main:app --reload |
| 45 | +``` |
36 | 46 |
|
37 |
| -## Using as an Application |
| 47 | +Then open your browser and navigate to `http://localhost:8000` |
38 | 48 |
|
39 |
| -You can use _janus_ as a streamlit product in two ways: |
| 49 | +### Using Docker: |
40 | 50 |
|
41 |
| -### 1. Using Docker (Recommended) |
42 |
| -Build and run the application locally using Docker: |
43 | 51 | ```bash
|
44 | 52 | # Build the Docker image
|
45 | 53 | docker build -t janus .
|
46 | 54 |
|
47 | 55 | # Run the container
|
48 |
| -docker run -p 8501:8501 janus |
| 56 | +docker run -p 8000:8000 janus |
49 | 57 | ```
|
50 |
| -Or use `make run`. Then open your browser and navigate to `http://localhost:8501` |
51 | 58 |
|
| 59 | +### Using Docker Compose (Recommended): |
| 60 | + |
| 61 | +```bash |
| 62 | +# Start the application |
| 63 | +docker-compose up -d |
| 64 | + |
| 65 | +# View logs |
| 66 | +docker-compose logs -f |
| 67 | + |
| 68 | +# Stop the application |
| 69 | +docker-compose down |
| 70 | +``` |
| 71 | + |
| 72 | +Then open your browser and navigate to `http://localhost:8000` |
| 73 | + |
| 74 | +## How to Use |
| 75 | + |
| 76 | +1. Enter your baseline variant name (e.g., "A" or "Control") |
| 77 | +2. Add your variants with their respective data: |
| 78 | + - Name: A unique identifier for the variant |
| 79 | + - Impressions: Total number of users/sessions exposed to this variant |
| 80 | + - Conversions: Number of successful conversions |
| 81 | + - Revenue: Total revenue generated by this variant |
| 82 | + |
| 83 | +3. Click "Run Analysis" to see the results: |
| 84 | + - Summary statistics for each variant |
| 85 | + - Conversion statistics with probability of being the best variant |
| 86 | + - ARPU statistics with probability of being the best variant |
| 87 | + |
| 88 | +4. Export your results as CSV if needed |
| 89 | + |
| 90 | +## API Documentation |
| 91 | + |
| 92 | +The API documentation is available at `/docs` when the application is running. |
| 93 | + |
| 94 | +## Technical Details |
| 95 | + |
| 96 | +This application uses: |
| 97 | +- [FastAPI](https://fastapi.tiangolo.com/) for the backend |
| 98 | +- [Bayesian-Testing](https://github.com/Matt52/bayesian-testing) for statistical calculations |
| 99 | +- Bootstrap 5 for the frontend UI |
| 100 | +- Jinja2 for HTML templating |
52 | 101 |
|
53 | 102 | ## References
|
| 103 | + |
54 | 104 | * [What is A/B Testing](https://en.wikipedia.org/wiki/A/B_testing)
|
55 | 105 | * The bayesian calculations were implemented based on [this VWO white paper](https://vwo.com/downloads/VWO_SmartStats_technical_whitepaper.pdf)
|
56 | 106 | * [Agile A/B testing with Bayesian Statistics and Python](https://web.archive.org/web/20150419163005/http://www.bayesianwitch.com/blog/2014/bayesian_ab_test.html)
|
|
0 commit comments