Calculate 95% Bootstrap Confidence Interval for Order Values
Company: Pinterest
Role: Data Scientist
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Overview: This question evaluates a data scientist's competence in statistical inference using bootstrap resampling, proficiency with numerical computing for large sample operations, and attention to performance optimization.
Constraints
- 1 <= len(order_values) <= 5000
- Order values are finite floats (can be zero or positive)
- Use exactly B = 10,000 bootstrap resamples with replacement
- RNG must be numpy.random.default_rng(seed) for determinism
- Percentile bounds are [2.5, 97.5]
- Return a list of two floats rounded to 6 decimals
Hints
- Use numpy.random.default_rng(seed).choice to generate resamples in a vectorized way.
- Compute means along axis=1 and then np.percentile at [2.5, 97.5].
- To limit memory, generate resamples in batches (e.g., 1000 at a time) while keeping vectorization within each batch.