Add test for MPI Markov chain statistics and fix Rhat
Created by: femtobit
Complementing the discussion in #365, these are tests that I believe the NetKet statistics should satisfy.
Note that test_var
currently uses ddof=0
and passes. I believe we should have a ddof
parameter on the NetKet functions as well, to apply the denominator corresction just as np.var
does.
The test_mc_stats
currently fails, due to the discrepancy in the computation of variance and Rhat
with ddof=1
we are discussing in #365. While for Rhat
, we should definitely use ddof=1
, I am not sure about stats.variance
, though I believe the correction is also appropriate there.
Also note that these tests use MPI. I haven't yet figured out how to conveniently run them together with the others using pytest
(at least not without producing duplicate output, as all processes print data with pytest
), but they can be run manually using, e.g, mpirun -np 2 python3 -m pytest -v Test/Stats/mpi_test_stats.py
.