O'Reilly logo

Test-Driven Machine Learning by Justin Bozonier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The problem with straight bootstrapping

What you could see happening was that with a single observation of data, bootstrapping will give the same answer every time. Ironically, this means that when you're bootstrapping such a small dataset, you will have zero variance. Here's an example in code:

plt.hist([np.random.choice([1]) for i in range(100)])

The histogram for sampling from a dataset that consists of only one element looks as follows:

The problem with straight bootstrapping

As predicted, every value is the same. This doesn't really match our intuition about uncertainty though. We have only observed a single number, but it could have just as easily been a different number. This technique ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required