def dpois(lmbda):
"""Poisson Distribution
lmbda = average number of successes per unit interval
Used to determine the probability of an amount of
successes occuring in a fixed interval (time, area…)
This doesn't return a value, but rather the specified Poisson function
"""
def p(k):
if 0 <= k:
return (exp(-lmbda) * lmbda**k) / factorial(k)
else:
return 0
# Allow accessing the used 'lmbda' value from the function
p.__dict__['lmbda'] = lmbda
p.__dict__['expected'] = lmbda
p.__dict__['variance'] = lmbda
return p
评论列表
文章目录