Commit 2206438b authored by Andrija Kostic's avatar Andrija Kostic
Browse files

Adjusted tolerance level for jacobian tests

parent f5a758ef
Pipeline #70222 passed with stages
in 15 minutes and 21 seconds
...@@ -47,7 +47,7 @@ def test_variablecovariancegaussian(field): ...@@ -47,7 +47,7 @@ def test_variablecovariancegaussian(field):
mf = ift.MultiField.from_dict(dc) mf = ift.MultiField.from_dict(dc)
energy = ift.VariableCovarianceGaussianEnergy(field.domain, energy = ift.VariableCovarianceGaussianEnergy(field.domain,
residual='a', inverse_covariance='b') residual='a', inverse_covariance='b')
ift.extra.check_jacobian_consistency(energy, mf, tol=1e-7) ift.extra.check_jacobian_consistency(energy, mf, tol=1e-6)
def test_gaussian(field): def test_gaussian(field):
energy = ift.GaussianEnergy(domain=field.domain) energy = ift.GaussianEnergy(domain=field.domain)
......
  • @reimar @mtr @parras

    Why do the tests pass for tolerance of 1e-6 on this machine here, but they pass with 1e-7 on my desktop as well as laptop?

  • There could be various reasons. For example, some FFTs in older versions of scipy were really inaccurate. It could also be a difference in the initial random seed.

  • I think the SEED is fixed in all cases to the same value, because I used the same test_energy_gradients.py file with SEED defined on line 33.

    Here in the ift.extra.check_jacobian_consistency I think most operations are just multiplications, additions and divisions so I was surprised that the difference already with these operations could be seen. Anyways, it was just interesting and I want to check whether it is not too strange to have this kind of difference. I will leave the tolerance then as it is with this push.

    Thanks!

  • I can't really tell for which operator you are running check_jacobian_consistency, but typically these operators are highly non-trivial and involve some kind of harmonic transform. If that is the case, I'd not be too worried about the change in tolerance. On the other hand, if you are sure that the tested operator only consists of really trivial operations, it might be worth investigating the reason for the lowered accuracy.

  • The operator is in the 'operators/energy_operators' file and it doesn't involve a HarmonicTransform. Maybe if you have time you can take a look and see whether this is okay.

  • There is at least a logarithm involved, so no wonder we get a bit of precision loss.

  • Correct. Okay, if you don't worry about this neither will I!

    Thanks for the comments!

  • At some point I need to take the time to analyze why we are only seeing accuracies in the 1e-6 to 1e-7 range, instead of something below 1e-12 ... probably due to the quadratic nature of the problem. @reimar, if you have a few minutes to discuss this, perhaps during coffee, that would be great!

Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment