pymc-experimental icon indicating copy to clipboard operation
pymc-experimental copied to clipboard

Monkeypatch sampling functions in statespace tests

Open jessegrabowski opened this issue 8 months ago • 4 comments

The CI for pymc-extras is extremely slow. This is due to a lot of sampling being done inside the statespace tests. An easy way to speed things up is to monkey patch pm.sample to just return an idata with some dummy data.

I believe @williambdean has already implemented something of this type for the main PyMC repo.

jessegrabowski avatar Apr 19 '25 23:04 jessegrabowski

Yes, there are options...

basic one

https://github.com/pymc-labs/pymc-marketing/blob/2a4dd0362804577b971482ea192bf5e817a8eb43/tests/conftest.py?plain=1#L128-L162

One that includes some sample_stats ( maybe not needed)

https://github.com/pymc-labs/pymc-marketing/blob/2a4dd0362804577b971482ea192bf5e817a8eb43/scripts/run_notebooks/injected.py?plain=1#L8-L36

https://github.com/pymc-devs/pymc-examples/blob/69563da49ceef589127140d3675a05b2ba4c3ae0/scripts/run_notebooks/injected.py?plain=1#L9-L69

williambdean avatar Apr 20 '25 15:04 williambdean

Would be something for pymc.testing module? Maybe just the mock_sample but not the fixture. That's quite specific and small

williambdean avatar Apr 22 '25 15:04 williambdean

Yes I agree. Something at the pymc level that could be used for any downstream package would be extremely welcome

jessegrabowski avatar Apr 22 '25 16:04 jessegrabowski

This is being partially addressed (in one file) by #510 . That PR can be used as a template for how to finish the rest (it's quite easy -- just need to import the fixture from pymc.testing then add it to any test or fixture that calls pm.sample )

jessegrabowski avatar Jun 12 '25 15:06 jessegrabowski