fix: Update `num_samples_saved` formula in `fit.py`
Fixes #366
Fixes the formula to calculate num_samples_saved.
Updates a test in tests/test_normal.py to hit this specific problem for both num_samples and num_warmup when save_warmup=True.
Looks good to me. Let's fix the CI before merging though.
This test does not raise any errors now. Is this due to update in httpstan or where in pystan code should it raise that error?
def test_bernoulli_sampling_invalid_argument(posterior):
with pytest.raises(TypeError, match=r"'float' object cannot be interpreted as an integer"):
posterior.sample(num_thin=2.0)
edit. Oh yeah, math.ceil makes the input an integer. Should we add an assert statement somewhere to check this?
First, let's adjust that test so it's more obvious what the problem is: num_thin=2.5 would be even clearer.
Sure, add an isinstance check (with a ValueError exception if it's not an integer). I think doing that is cleaner than an assert.
LGTM!