[x] I have checked to ensure there aren't other open Pull Requests for the same update/change
[x] I have updated the documentation accordingly.
Describe your fixes/additions/changes
In src/pySODM/optimization/objective_functions.py, the uniform prior probability was implemented as follows,
def log_prior_uniform(x, bounds):
""" Uniform log prior distribution """
prob = 1/(bounds[1]-bounds[0])
condition = bounds[0] <= x <= bounds[1]
if condition == True:
# should be set to zero to accomodate bounds = np.inf --> prob is inf!!!
return np.log(prob)
else:
return -np.inf
which, when given an infinite bound (i.e. having no physical bound to the parameter) returned an error because prob --> 0, so np.log(prob) --> inf.
As we are taking the log sum of the prior probabilities and likelihood, the value of this probability does not influence the location of the maximal log posterior probability, so I've changed this to simply returning a probability of zero,
def log_prior_uniform(x, bounds):
""" Uniform log prior distribution """
prob = 1/(bounds[1]-bounds[0])
condition = bounds[0] <= x <= bounds[1]
if condition == True:
# should be set to zero to accomodate bounds = np.inf --> prob is inf!!!
return 0
else:
return -np.inf
Describe your fixes/additions/changes
In
src/pySODM/optimization/objective_functions.py
, the uniform prior probability was implemented as follows,which, when given an infinite bound (i.e. having no physical bound to the parameter) returned an error because
prob --> 0
, sonp.log(prob) --> inf
.As we are taking the log sum of the prior probabilities and likelihood, the value of this probability does not influence the location of the maximal log posterior probability, so I've changed this to simply returning a probability of zero,