Skip to content

Commit

Permalink
Added an option to show the delta log-likelihood
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyoneda committed Nov 2, 2024
1 parent f7d5f29 commit 54999aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cosipy/image_deconvolution/MAP_RichardsonLucy.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ def check_stopping_criteria(self):

log_likelihood = np.sum(self.results[-1]["log-likelihood"])
log_likelihood_before = np.sum(self.results[-2]["log-likelihood"])

logger.debug(f'Delta log-likelihood: {log_likelihood - log_likelihood_before}')

if log_likelihood - log_likelihood_before < self.stopping_criteria_threshold:
return True
Expand All @@ -283,6 +285,8 @@ def check_stopping_criteria(self):
log_posterior = self.results[-1]["log-posterior"]
log_posterior_before = self.results[-2]["log-posterior"]

logger.debug(f'Delta log-posterior: {log_posterior - log_posterior_before}')

if log_posterior - log_posterior_before < self.stopping_criteria_threshold:
return True

Expand Down
2 changes: 2 additions & 0 deletions cosipy/image_deconvolution/RichardsonLucy.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def check_stopping_criteria(self):

log_likelihood = np.sum(self.results[-1]["log-likelihood"])
log_likelihood_before = np.sum(self.results[-2]["log-likelihood"])

logger.debug(f'Delta log-likelihood: {log_likelihood - log_likelihood_before}')

if log_likelihood - log_likelihood_before < self.stopping_criteria_threshold:
return True

Check warning on line 183 in cosipy/image_deconvolution/RichardsonLucy.py

View check run for this annotation

Codecov / codecov/patch

cosipy/image_deconvolution/RichardsonLucy.py#L183

Added line #L183 was not covered by tests
Expand Down

0 comments on commit 54999aa

Please sign in to comment.