Skip to content

Commit 1aba9df

Browse files
Jammy2211Jammy2211
authored andcommitted
first attempt
1 parent 6acc836 commit 1aba9df

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

autofit/non_linear/fitness.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,17 @@ def call(self, parameters):
159159
# Get instance from model
160160
instance = self.model.instance_from_vector(vector=parameters)
161161

162-
# Evaluate log likelihood (must be side-effect free and exception-free)
163-
log_likelihood = self.analysis.log_likelihood_function(instance=instance)
162+
if self._xp.__name__.startswith("jax"):
163+
164+
# Evaluate log likelihood (must be side-effect free and exception-free)
165+
log_likelihood = self.analysis.log_likelihood_function(instance=instance)
166+
167+
else:
168+
169+
try:
170+
log_likelihood = self.analysis.log_likelihood_function(instance=instance)
171+
except exc.FitException:
172+
return self.resample_figure_of_merit
164173

165174
# Penalize NaNs in the log-likelihood
166175
log_likelihood = self._xp.where(self._xp.isnan(log_likelihood), self.resample_figure_of_merit, log_likelihood)

0 commit comments

Comments
 (0)