Imagine the following business problem:
A call center has a rule that if more than 8 customers calls in 24 hours about Issue X, then there should be an alarm & that that Issue X should be forwarded to Tier 2 team for further investigation. However, the Tier 2 team believes that 24 hours is too long to wait since the customer experience could suffer. They want to predict BEFORE the 24 hour interval. Therefore, they want the probability at any given time based on historical hourly calling pattern if the 8 customers calling in 24 hours will be breached?
Enter the Poisson distribution. From Wikipedia.
The Poisson distribution can be applied to systems with a large number of possible events, each of which is rare. How many such events will occur during a fixed time interval? Under the right circumstances, this is a random number with a Poisson distribution.
Poisson Distribution Definition
A discrete random variable X is said to have a Poisson distribution with parameter λ > 0, if, for k = 0, 1, 2, …, the probability mass function of X is given by:
where
The positive real number λ is equal to the expected value of X and also to its variance^{[7]}
Scipy is a python library that is used for Analytics,Scientific Computing and Technical Computing. Using stats.poisson module we can easily compute poisson distribution of a specific problem
To calculate poisson distribution we need two variables
The formula for poisson distribution using scipy module:
Proabability_reached = float(1-scipy.stats.distributions.poisson.cdf(poisson random variable-1, rate_of_success)) * 100
Code For Poisson Distribution
import scipy from scipy.stats import poisson def poisson_probability(alarmlimit,no_of_calls,current_time): hourly_rate = float(alarmlimit)/24.0 remain_hours = 24 - int(current_time) rate_of_success = float(remain_hours * hourly_rate) if alarmlimit > no_of_calls and remain_hours!=0: """poisson variable is remaining no of calls to reach the limit""" poisson_variable = alarmlimit - no_of_calls probability_remain = float(scipy.stats.distributions.poisson.pmf(poisson_variable, rate_of_success))*100 probability_reached = float(1-scipy.stats.distributions.poisson.cdf(poisson_variable-1, rate_of_success)) * 100 elif alarmlimit > no_of_calls and remain_hours==0: poisson_variable = alarmlimit - no_of_calls probability_remain = 0 probability_reached = 0 else: poisson_variable = 0 probability_reached = 100 return (poisson_variable,hourly_rate,remain_hours,probability_reached, rate_of_success) if __name__=="__main__": alarmlimit=8 no_of_calls=2 current_time=2#its hours poisson_variable,hourly_rate,remain_hours,probability_reached,rate_of_success = poisson_probaility(alarmlimit,no_of_calls,current_time) print "poisson Variable x is %d"%(poisson_variable) print "Rate of Success in hour %f"%(hourly_rate) print "Rate of Success %f"%(rate_of_success) print "Remaining hours %d"%(remain_hours) print "Probability Reached %f"%(probability_reached) |
output from program:
We can check the Poisson distribution values with an online calculator
24 Hour Limit |
1 Hour Rate |
# of Calls |
Study Period (in hours) |
Remaining Periods |
Poisson Variable (X) |
Rate of Success |
Probability that limit will be breached (%) |
8 |
0.33 |
2 |
2 |
22 |
6 |
7.33 |
74 |
9 |
0.375 |
4 |
4 |
20 |
5 |
7.50 |
87 |
6 |
0.25 |
3 |
5 |
19 |
3 |
4.75 |
85 |
12 |
0.50 |
8 |
3 |
21 |
4 |
10.50 |
99 |
7 |
0.29 |
1 |
1 |
23 |
6 |
6.70 |
66 |
15 |
0.625 |
3 |
6 |
18 |
12 |
11.25 |
45 |
© 2019 Data Science Central ® Powered by
Badges | Report an Issue | Privacy Policy | Terms of Service
You need to be a member of Data Science Central to add comments!
Join Data Science Central