Skip to content

Commit

Permalink
Update fit_fcn.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tsikes committed Nov 4, 2021
1 parent f9d11e8 commit 7821587
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/calculate/optimize/fit_fcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,13 @@ def append_output(output_dict, calc_resid_output):
loss_alpha = 2.0

else:
loss_alpha_fcn = lambda alpha: self.calculate_obj_fcn(loss_resid, alpha, log_opt_rates, output_dict)
loss_alpha_fcn = lambda alpha: self.calculate_obj_fcn(x, loss_resid, alpha, log_opt_rates, output_dict)

res = minimize_scalar(loss_alpha_fcn, bounds=[-100, 2], method='bounded')
loss_alpha = res.x

print([loss_alpha, *exp_loss_alpha])
obj_fcn = self.calculate_obj_fcn(loss_resid, loss_alpha, log_opt_rates, output_dict)
obj_fcn = self.calculate_obj_fcn(x, loss_resid, loss_alpha, log_opt_rates, output_dict)

# For updating
self.i += 1
Expand Down Expand Up @@ -388,7 +388,7 @@ def append_output(output_dict, calc_resid_output):
else:
return obj_fcn, x, output_dict['shock']

def calculate_obj_fcn(self, loss_resid, alpha, log_opt_rates, output_dict, loss_outlier=0):
def calculate_obj_fcn(self, x, loss_resid, alpha, log_opt_rates, output_dict, loss_outlier=0):
if np.size(loss_resid) == 1: # optimizing single experiment
loss_outlier = 0
loss_exp = loss_resid
Expand Down

0 comments on commit 7821587

Please sign in to comment.