Skip to content

Commit

Permalink
MIX can now be used with parametric FODs with SMT models
Browse files Browse the repository at this point in the history
  • Loading branch information
rutgerfick committed Feb 27, 2018
1 parent ef1cb14 commit e367f5b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions dmipy/optimizers/mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,22 @@ def __call__(self, data, x0_vector=np.array([np.nan])):
# if there is only one model then MIX only uses DE.
if self.Nmodels == 1:
# step 1: stochastic optimization on non-linear parameters.
fitted_parameters = differential_evolution(
res_de = differential_evolution(
self.stochastic_objective_function,
bounds=bounds_de,
maxiter=self.maxiter,
args=(data, self.acquisition_scheme, x0_vector),
polish=True).x
return fitted_parameters

if np.all(np.isnan(x0_vector)):
fitted_parameters = res_de
return fitted_parameters
else:
x0_bool_array = ~np.isnan(x0_vector)
fitted_parameters = np.ones(len(x0_bool_array))
fitted_parameters[~x0_bool_array] = res_de
fitted_parameters[x0_bool_array] = x0_vector[
x0_bool_array]
return fitted_parameters
# if there is more than 1 model then we do the 3 steps.
if self.Nmodels > 1:
# step 1: stochastic optimization on non-linear parameters.
Expand Down

0 comments on commit e367f5b

Please sign in to comment.