Skip to content

Commit

Permalink
modify MCMC input parameter to have n_thin as an input to enable thin…
Browse files Browse the repository at this point in the history
…ning the results.
  • Loading branch information
TannazH committed May 22, 2024
1 parent cfe5763 commit a1a779d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pyelq/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ELQModel:
mcmc (MCMC): MCMC object containing model and sampler specification for the problem. Constructed from the
other components in self.to_mcmc().
n_iter (int): number of MCMC iterations to be run.
n_thin (int): number of iterations to thin by.
fitted_values (np.ndarray): samples of fitted values (i.e. model predictions for the data) generated during the
MCMC sampler. Attached in self.from_mcmc().
Expand All @@ -52,6 +53,7 @@ class ELQModel:
model: Model = field(init=False)
mcmc: MCMC = field(init=False)
n_iter: int = 1000
n_thin: int = 1
fitted_values: np.ndarray = field(init=False)

def __init__(
Expand Down Expand Up @@ -151,7 +153,7 @@ def to_mcmc(self):
for component in self.components.values():
sampler_list = component.make_sampler(self.model, sampler_list)

self.mcmc = MCMC(initial_state, sampler_list, self.model, n_burn=0, n_iter=self.n_iter)
self.mcmc = MCMC(initial_state, sampler_list, self.model, n_burn=0, n_iter=self.n_iter, n_thin= self.n_thin)

def run_mcmc(self):
"""Run the mcmc function."""
Expand Down

0 comments on commit a1a779d

Please sign in to comment.