Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 13 additions & 4 deletions autolens/interferometer/model/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,19 @@ def log_likelihood_function(self, instance, shared=None):
instance=instance,
)

return (
self.fit_from(instance=instance, preloads=shared).figure_of_merit
- log_likelihood_penalty
)
if self._use_jax:
return (
self.fit_from(instance=instance, preloads=shared).figure_of_merit
- log_likelihood_penalty
)

try:
return (
self.fit_from(instance=instance, preloads=shared).figure_of_merit
- log_likelihood_penalty
)
except Exception as e:
raise af.exc.FitException

def shared_state_from(self, instance: af.ModelInstance):
"""
Expand Down
8 changes: 7 additions & 1 deletion autolens/point/model/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ def log_likelihood_function(self, instance):
float
The log likelihood indicating how well this model instance fitted the imaging data.
"""
return self.fit_from(instance=instance).log_likelihood
if self._use_jax:
return self.fit_from(instance=instance).log_likelihood

try:
return self.fit_from(instance=instance).log_likelihood
except Exception as e:
raise af.exc.FitException

def fit_from(
self,
Expand Down
Loading