I am trying to implement the Gamma PDF function for the integer argument. First I have implemented it with exponential terms but there were overflows, so I tried to compute the log of it, but the log goes to -inf
as alpha and beta are increased.
Is there any idea how to implement Gamma PDF from scratch?
Here is my implementation:
log_gamma = a * np.log(b) + (a-1) * np.log(lam) - b * lam - np.log(factorial(a-1))