1

Bootstrapping

Unsolved
Prob. and Stats

Difficulty: 3 | Problem written by TANVEER HURRA
Problem reported in interviews at

Amazon
Apple
Facebook
Google
Netflix

Bootstrapping is a process of resampling again and again from a given sample, with replacement, in order to estimate the sampling distribution and hence the population parameter. In this problem, you will learn the process of generating the sampling distribution from a single sample through bootstrapping.

Given a list of data, take out 50 repeated samples with replacement and calculate the mean of each sample.

The size of each sample must be equal to the size of the original list and the 50 mean values (desired output) must be stored in a separate list.

P.S: It is recommended to use list comprehension & avoid using a for loop. Also, you can use the python package random for sampling.

Set the seed to 100 (random.seed(100)) before running the code.

Sample Input:
<class 'list'>
data: [1, 22, 15, 9, 11, 7, 16, 23]

Expected Output:
<class 'list'>
[12.125, 12.875, 19.5, 11.25, 15.75, 15.5, 13.5, 15.375, 14.25, 9.375, 9.375, 12.125, 14.625, 9.375, 15.625, 14.875, 16.75, 10.625, 11.875, 12.75, 15.75, 11.25, 9.5, 6.625, 16.625, 14.875, 9.625, 12.0, 10.75, 14.75, 15.25, 12.625, 11.875, 13.25, 16.125, 13.625, 10.75, 14.125, 14.75, 9.625, 14.625, 11.125, 13.0, 12.25, 11.875, 15.25, 10.125, 12.0, 9.875, 17.125]

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Alias expedita mollitia, libero repellendus incidunt mollitia fugiat eaque eius perferendis accusantium? Doloremque repellendus maxime quis ipsa accusantium quaerat praesentium aspernatur sed, at obcaecati ab praesentium eum sapiente, corrupti placeat doloremque, error sit numquam obcaecati? Reiciendis dolorem cumque perspiciatis impedit rem explicabo, dolorem exercitationem nisi atque ducimus voluptatem asperiores necessitatibus, laborum quod reiciendis. Delectus omnis cupiditate quibusdam similique qui corrupti, quas pariatur sit neque enim dolorum reiciendis.

Officiis itaque voluptatum quas incidunt, voluptate nihil dolore tenetur animi impedit fuga necessitatibus ab rerum inventore explicabo, dolorem illum dolore ipsa sequi obcaecati, iusto impedit quasi quae laborum harum voluptatum ut, eaque laudantium incidunt ratione optio est impedit dolor quasi?

Assumenda unde exercitationem ducimus sequi repellendus debitis rerum voluptatibus soluta iusto laboriosam, odit animi architecto dolorum nesciunt consequatur vel, iste nulla sapiente eos repellendus voluptate eaque doloribus atque neque, quas unde deleniti veniam rem nam fuga temporibus adipisci deserunt nihil?

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)