Pergunta de entrevista da empresa Google

write code to generate iid draws from distribution X when we only have access to a random number generator

Respostas da entrevista

Sigiloso

27 de nov. de 2020

``` # Write code to generate iid draws from distribution X when we only have access to a random number generator from scipy.stats import uniform from scipy.stats import norm import seaborn as sns def IID_draws(): # Idea : use the random number generator as the CDF value for the known distribution r = uniform.rvs(loc = 0, scale = 1) X = norm(loc = 0, scale = 1).ppf(r) return X res = [] for _ in range(1000): res.append(IID_draws()) # sns.distplot(res) ```

3

Sigiloso

12 de set. de 2020

Use acceptance - rejection sampling

1

Sigiloso

24 de set. de 2020

Usw the cdf of the distribution and take its inverse and apply that function to the output of random number generator.

1

Sigiloso

24 de set. de 2020

Use the cdf of the distribution and take its inverse and apply that function to the output of random number generator.

1

Sigiloso

26 de fev. de 2021

The key in these questions is to cover the fundamentals, and be ready for the back-and-forth with the interviewer. Might be worth doing a mock interview with one of the Google or ex-Google Data Scientist experts on Prepfully? They give real-world practice and guidance, which is pretty helpful. prepfully.com/practice-interviews

2