Skip to content

Commit

Permalink
Add a tolerance to differential_evolution
Browse files Browse the repository at this point in the history
  • Loading branch information
davidt0x committed Oct 15, 2024
1 parent ecfb6f2 commit 3a0cdbe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion tests/composition/pec/test_parameterestimationcomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,12 @@ def reward_rate(sim_data):
pec.run(inputs={comp: trial_inputs})

if expected_result is not None:
np.testing.assert_allclose(list(pec.optimized_parameter_values.values()), expected_result)
if opt_method == "differential_evolution":
np.testing.assert_allclose(
list(pec.optimized_parameter_values.values()), expected_result, rtol=1e-3
)
else:
np.testing.assert_allclose(list(pec.optimized_parameter_values.values()), expected_result)


def test_parameter_estimation_ddm_cond(func_mode):
Expand Down
2 changes: 1 addition & 1 deletion tests/composition/pec/test_stab_flex_pec_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def test_stab_flex_cond_fit():

inputs = make_input_dict(comp, taskTrain, stimulusTrain, cueTrain, correctResponse)

ret = pec.run(inputs=inputs)
pec.run(inputs=inputs)
optimal_parameters = pec.optimized_parameter_values

# These aren't the recovered parameters, we are doing too few trials and too few estimates to get the correct
Expand Down

0 comments on commit 3a0cdbe

Please sign in to comment.