Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loc argument to gamma prior #114

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/pySODM/optimization/objective_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ def log_prior_gamma(x,gamma_params):
x: float
Parameter value whos probability we want to test.
gamma_params: tuple
Tuple containg gamma parameters alpha and beta.
Tuple containg gamma parameters alpha, beta and loc (shift along x-axis).

Returns
-------
Log probability of sample x in light of a gamma prior distribution.

"""
a,b = gamma_params
return gamma.logpdf(x, a=a, scale=1/b)
a,b,loc = gamma_params
return gamma.logpdf(x, a=a, scale=1/b, loc=loc)

def log_prior_weibull(x,weibull_params):
""" Weibull log prior distribution
Expand All @@ -248,15 +248,15 @@ def log_prior_weibull(x,weibull_params):
x: float
Parameter value whos probability we want to test.
weibull_params: tuple
Tuple containg weibull parameters k and lambda.
Tuple containg weibull parameters k, lambda and loc (shift along x-axis).

Returns
-------
Log probability of sample x in light of a weibull prior distribution.

"""
k,lam = weibull_params
return gamma.logpdf(x, k, shape=lam, loc=0 )
k,lam,loc = weibull_params
return gamma.logpdf(x, k, shape=lam, loc=loc)

#############################################
## Computing the log posterior probability ##
Expand Down
Loading