Skip to content

Commit

Permalink
[sigma_adaptation] polish TPA warning condition
Browse files Browse the repository at this point in the history
  • Loading branch information
nikohansen committed Sep 3, 2024
1 parent 75d3531 commit fdc131f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cma/sigma_adaptation.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,15 @@ def check_consistency(self, es):
/ (es.pop[0][i] - es.mean[i])
dmi_div_dx1i = (es.mean_after_tell[i] - es.mean_old[i]) \
/ (es.pop[1][i] - es.mean[i])
expected_precision = 1e-11 * max((1, np.abs(es.mean[i]) / es.stds[i],
np.abs(es.mean[j]) / es.stds[j]))
# was: expected_precision = 1e-4
if not Mh.equals_approximately(
dmi_div_dx0i, dm / dx0, 1e-4) or \
dmi_div_dx0i, dm / dx0, expected_precision) or \
not Mh.equals_approximately(
dmi_div_dx1i, dm / dx1, 1e-4):
dmi_div_dx1i, dm / dx1, expected_precision):
print()
print(i, expected_precision, es.mean[i])
m = utils.format_warning(
'TPA: apparent inconsistency with mirrored'
' samples, where dmi_div_dx0i, dm/dx0=%f, %f'
Expand Down

0 comments on commit fdc131f

Please sign in to comment.