You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At this point we can see two differently ordered dictionaries. Since the position of items in the prior dictionaries is used during sampling, this will lead to undeterministic behaviour despite seeding. I assume the
UserWarning: No hashed prior found. Sample frequencies may diverge from the prior. Consider burning this prior first.
warning might be related to this issue (if the hash that is being referred to is in fact the position as int), but I am not sure and I think this should be solved instead of warning about it, anyways.
Here is my recommended fix: Instead of making sure that the outputs of structure_prior_from[_max]_depth returns deterministic and ordered results, the sampling of equations should not depend on the ordering of (usually unordered) dictionaries. Since the dictionary/prior keys are strings, we can use the sorted strings as an arbitrary but deterministic ordering, by including the following line in sample.sample:
Or more explicitly: iterate over the priors and then do the dict comprehension individiually. Also, apparently nowadays any python dict is ordered, not only OrderedDicts, so after this point we don't have to worry anymore.
I'm not sure if there are additional chunks that need to be changed, but this fix worked pretty well for my own use-case.
Cheers,
Leonard
The text was updated successfully, but these errors were encountered:
How to reproduce:
restart runtime
At this point we can see two differently ordered dictionaries. Since the position of items in the prior dictionaries is used during sampling, this will lead to undeterministic behaviour despite seeding. I assume the
UserWarning: No hashed prior found. Sample frequencies may diverge from the prior. Consider burning this prior first.
warning might be related to this issue (if the hash that is being referred to is in fact the position as int), but I am not sure and I think this should be solved instead of warning about it, anyways.
Here is my recommended fix: Instead of making sure that the outputs of
structure_prior_from[_max]_depth
returns deterministic and ordered results, the sampling of equations should not depend on the ordering of (usually unordered) dictionaries. Since the dictionary/prior keys are strings, we can use the sorted strings as an arbitrary but deterministic ordering, by including the following line insample.sample
:Or more explicitly: iterate over the priors and then do the dict comprehension individiually. Also, apparently nowadays any python dict is ordered, not only
OrderedDict
s, so after this point we don't have to worry anymore.I'm not sure if there are additional chunks that need to be changed, but this fix worked pretty well for my own use-case.
Cheers,
Leonard
The text was updated successfully, but these errors were encountered: