Skip to content

Commit c610f03

Browse files
committed
changed defaults for gibbs.Gibbs to g=100, gskip=1
- updated gibbs.Gibbs - updated tests
1 parent f279b4d commit c610f03

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ The rules for this file:
2525
set the default to 100 (as in the paper) and ensure that the correct value
2626
is used as Gibbs.gskip (which is relative to the save skip step of Gibbs.g)
2727
(Issue #48)
28-
28+
29+
### Changed
30+
* Default kwargs for the skipping in the Gibbs sampler are now
31+
gibbs.Gibbs(g=100, gskip=1) (used to be g=50, gskip=2) but for most users
32+
gskip for processing data is not important and it makes more sense to focus
33+
on g as the stride at which we sample AND process data (#48, PR #49)
34+
2935

3036
## [1.1.2] - 2025-07-22
3137

basicrta/gibbs.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,23 @@ class Gibbs(object):
116116
directory to load/save results. Allows for multiple cutoffs
117117
to be tested in directory containing contacts.
118118
:type cutoff: float
119+
:param g: Gibbs skip parameter for decorrelated samples;
120+
only save every `g` samples from full Gibbs sampler chain;
121+
default from https://pubs.acs.org/doi/10.1021/acs.jctc.4c01522
122+
(NOTE: this value is called *gskip* in cluster.py)
123+
:type g: int
124+
:param burnin: Burn-in parameter, drop first `burnin` samples as equilibration;
125+
default from https://pubs.acs.org/doi/10.1021/acs.jctc.4c01522
126+
:type burnin: int
127+
:param gskip: Process data from the subsampled chain (ever `g` samples) at a
128+
coarser skip interval of `gskip` samples. Thus, in total, samples
129+
are taken at ``g * gskip`` steps from the full chain.
130+
(This is useful for sensitivity analysis where we run the chain with
131+
a small `g` value and save many samples and then use `gskip` to process
132+
samples at increasingly larger intervals without having to re-run the
133+
chain.) The default value of 1 means that the samples are processed at
134+
every `g` samples from the full chain.
135+
:type gskip: int
119136
120137
EXAMPLE
121138
-------
@@ -139,7 +156,7 @@ class Gibbs(object):
139156
"""
140157

141158
def __init__(self, times=None, residue=None, loc=0, ncomp=15, niter=110000,
142-
cutoff=None, g=50, burnin=10000, gskip=2):
159+
cutoff=None, g=100, burnin=10000, gskip=1):
143160
self.times = times
144161
self.residue = residue
145162
self.niter = niter

basicrta/tests/test_combine_contacts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ def test_gibbs_sampler_integration(self, tmp_path, create_mock_contacts):
265265
ncomp=2, # Use 2 components for stability
266266
niter=1000, # 1000 steps as requested
267267
burnin=5, # 5 burnin steps as requested
268+
g=50,
269+
gskip=1,
268270
cutoff=7.0 # Set cutoff for directory creation
269271
)
270272

basicrta/tests/test_gibbs.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ class TestGibbsSampler:
127127
'cutoff': 7.0,
128128
'g': 100
129129
},
130+
{
131+
'times': None, # Will be set from fixture
132+
'residue': 'W313',
133+
'ncomp': 2,
134+
'niter': 1000,
135+
'burnin': 5,
136+
'cutoff': 7.0,
137+
'g': 50,
138+
'gskip': 2
139+
},
130140
])
131141
def test_gibbs_run_method(self, tmp_path, synthetic_timeseries, init_kwargs):
132142
"""Test the run() method for Gibbs class with synthetic data."""

0 commit comments

Comments
 (0)