Skip to content

Commit

Permalink
Merge branch 'main' into h5py_dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
lbluque authored Dec 18, 2023
2 parents f0d5e91 + b419e7d commit 8642e4d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions smol/moca/sampler/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,14 @@ def traced_values(self):
return self._trace.names

def sampling_efficiency(self, discard=0, flat=True):
"""Return the sampling efficiency for chains."""
"""Return the sampling efficiency for chains.
If the sampling is thinned by > 1, this value becomes only an estimate for the
true sampling efficiency, as we do not know the efficiency of the discarded
samples.
"""
total_accepted = self._trace.accepted[discard:].sum(axis=0)
efficiency = total_accepted / (self._total_steps - discard)
efficiency = total_accepted / (self._nsamples - discard)
if flat:
efficiency = efficiency.mean()
return efficiency
Expand Down

0 comments on commit 8642e4d

Please sign in to comment.