GithubHelp home page GithubHelp logo

rlugojr / bootstrapped Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookarchive/bootstrapped

0.0 1.0 0.0 690 KB

Generate bootstrapped confidence intervals for A/B testing in Python.

License: Other

Python 99.81% Shell 0.19%

bootstrapped's Introduction

bootstrapped - confidence intervals made easy

bootstrapped is a Python library that allows you to build confidence intervals from data. This is useful in a variety of contexts - including during ad-hoc a/b test analysis.

Motivating Example

Imagine we own a website and think changing the color of a 'subscribe' button will improve signups. One method to measure the improvement is to conduct an A/B test where we show 50% of people the old version and 50% of the people the new version. We can use a method called 'the bootstrap' to understand how much the button color improves responses and give us the error bars associated with the test - this will give us lower and upper bounds on how good we should expect the change to be!

bootstrapped - Benefits

  • Efficient computation of confidence intervals
  • Functions to handle single populations and a/b tests
  • Functions to understand statistical power

Example Usage

import numpy as np
import bootstrapped.bootstrap as bs
import bootstrapped.stats_functions as bs_stats

mean = 100
stdev = 10

population = np.random.normal(loc=mean, scale=stdev, size=50000)

# take 1k 'samples' from the larger population
samples = population[:1000]

print(bs.bootstrap(samples, stat_func=bs_stats.mean))
>> 100.08  (99.46, 100.69)

print(bs.bootstrap(samples, stat_func=bs_stats.std))
>> 9.49  (9.92, 10.36)

Extended Examples

Requirements

bootstrapped requires numpy. The power analysis functions require matplotlib and pandas.

Installation

# clone bootstrapped 
cd bootstrapped 
pip install -r requirements.txt 
python setup.py install

How bootstrapped works

tldr - Percentile based confidence intervals based on bootstrap re-sampling with replacement.

Bootstrapped generates confidence intervals given input data by:

  • Generating a large number of samples from the input (re-sampling)
  • For each re-sample, calculate the mean (or whatever statistic you care about)
  • Of these results, calculate the 2.5th and 97.5 percentiles (default range)
  • Use this as the 95% confidence interval

For more information please see:

  1. Bootstrap confidence intervals (good intro)
  2. An introduction to Bootstrap Methods
  3. The Bootstrap, Advanced Data Analysis
  4. When the bootstrap dosen't work
  5. (book) An Introduction to the Bootstrap
  6. (book) Bootstrap Methods and their Application

See the CONTRIBUTING file for how to help out.

Contributors

Spencer Beecher, Don van der Drift, David Martin, Lindsay Vass, Sergey Goder, Benedict Lim, and Matt Langner.

Special thanks to Eytan Bakshy.

License

bootstrapped is BSD-licensed. We also provide an additional patent grant.

bootstrapped's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.