AW

learning from data with humnans

Bootstrapping essentials in python

I am not a statistician by training1 but rather and engineer appreciating statistics and enjoying building data products. No surprise something as practical as bootstrapping fascinates me. Bootstrapping is a statistical technique that helps estimating the uncertainty associated to any population statistic of interest (mean, median…).

So, what can bootstrapping do for you? It allows to determine confidence interval in a a very general way. If you need deep concetration to describe what a “confidence interval”2 is, keep reading on: knowing bootstrapping also improves the grasp of this concept.

What bootstrapping can’t do is improving your point estimate of the statistic. Let’s suppose you need to estimate the median of a population and you have 101 datapoints at hand. The median point estimate is obtained by ordering your data -ascending for instance- and get the 50th item in the list. By using bootstrapping, you can supplement your point estimate with uncertainties statement. Your number won’t be $^{x}$ anymore but somwhere between $[^{x}-s_1, ^{x}+s_1]$ with a given confidence level $c$, say 95%3.

A motivating example

Mario pushed his model to production yesterday ….

The core idea

The bootstrap core idea is that the we can estimate the dispersion a given statistic by running multiple experiments on a data sample.

Good stuff

  1. https://speakerdeck.com/jakevdp/statistics-for-hackers?slide=138
  2. https://yanirseroussi.com/2019/01/08/hackers-beware-bootstrap-sampling-may-be-harmful/
  3. https://yanirseroussi.com/2020/08/24/many-is-not-enough-counting-simulations-to-bootstrap-the-right-way/
  4. https://erikbern.com/2018/10/08/the-hackers-guide-to-uncertainty-estimates.html

  1. is it possible to become one? ↩︎

  2. I am highly confident almost everybody struggles with this ↩︎

  3. why choosing 95% confidence? In common practice 95% and 90% and 67% are often used, but this is just conventional. Use whatever is most appropriate to your application, just don’t tune it after looking at the results. Also notice that the confidence level $c$ is the complimentary of the significance level $\alpha=1-c$ ↩︎