Given this python code
success = np.array([1, 2, 3, 4, 5])
failure = np.array([12, 13, 14, 15, 16])
beta_samples = np.random.beta(success + 1, failure + 1, size = 5)
print(beta_samples)
beta_samples2 = [np.random.beta(success[i] + 1, failure[i] + 1) for i in range(5)]
print(beta_samples2)
The output of the python code is:
[0.22023725 0.18643029 0.14765836 0.12017337 0.39477445]
[0.22605254862542162, 0.12566539444840888, 0.13290508184544317, 0.2718239044172474, 0.1464185003569084]
Why am I getting two completely different Beta distribution samples, given that I use the same success
and failure
arrays?
which one is correct and which one is incorrect?
This is because later on I need to choose the location/ index of the max-value in these beta samples using the argmax(...)
function and currently, both of these samples will give me different index/location.