Walmart DS Interview: Acing Expected Value & Probability Problem

Ace Walmart data science interviews with a practice problem on customer coupons using probability & expected value. Solution included!

Mentor

Blog

For a data-driven retailer like Walmart, understanding customer behaviours and promotional impacts is important.

One type of question Walmart data scientists can expect is calculating expected values and probabilities in real-world business scenarios.

Questions like these evaluate your ability to model situations using core statistical concepts.

Let's take a look.

Problem Statement:

If you give N users a 5$ coupon, with the probability of usage being P, what is the expected coupon spend? What assumptions would you make to underpin that answer? What is the probability that one of the coupons will be used?

Solution:

To solve this problem, we need to make some assumptions and use the concepts of expected value and probability.

Assumptions:

  1. Each user acts independently when deciding to use the coupon.
    1. The probability of using the coupon (P) is the same for all users.
      1. The value of the coupon is fixed at $5.

        Expected Coupon Spend:  šŸ‘‡

        To calculate the expected coupon spend:

        Expected Spend = Number of Users (N) * Value of Coupon * Probability of Usage (P)

        Expected Coupon Spend = N Ɨ $5 Ɨ P

        For example, if you have 1000 users (N = 1000) and the probability of using the coupon is 0.2 (P = 0.2), then the expected coupon spend would be:

        Expected Coupon Spend = 1000 Ɨ $5 Ɨ 0.2 = $1000

        This means that, on average, the company would spend $1000 on redeemed coupons if the scenario is repeated many times.

        The probability that at least one coupon will be used:  šŸ‘‡

        The probability that at least one coupon will be used can be found by subtracting the probability that no coupons are used from 1.

        Let Q be the probability that a single user does not use the coupon.

        Then, Q = 1 - P.

        The probability that none of the N users use the coupon is Q^N, assuming independence of events.

        Therefore, the probability that at least one coupon will be used is:

        Probability (at least one coupon used) = 1 - Q^N = 1 - (1 - P)^N

        For example, if you have 1000 users (N = 1000) and the probability of using the coupon is 0.2 (P = 0.2), then the probability that at least one coupon will be used is:

        Probability (at least one coupon used) = 1 - (1 - 0.2)^1000 ā‰ˆ 0.9999999999999999

        This means that it is almost certain (with a probability very close to 1) that at least one coupon will be used when distributing 1000 coupons with a usage probability of 0.2.

        *****

        If you're prepping for an upcoming Walmart data science interview, make sure you have a firm handle on basic statistics and probability.

        You can connect with me if you want to know more about the kinds of questions Walmart asks and get some practice examples.

        As someone working at Walmart, I can help you prepare for the technical as well as the behavioural part of the interview process.


        Also read:  šŸ‘‡

        SQL Interview Question: Retrieving Top Customers by Total Spend