How come pm.sample() doesn't tell you when you pass in a bad argument?

I got confused for a while as to why I was getting so many divergences before I realised it was because I’d typed in the target_accept argument wrong into pm.sample(). I had

trace = pm.sample(4000, tune=1000, target_accept=.95)

Instead of

trace = pm.sample(4000, tune=1000, nuts_kwargs=dict(target_accept=.95))

Easy mistake to make, right? The bad input failed silently and the target_accept used the default of 0.8 instead of what I wanted. I feel like it should throw an exception (or at least a warning) when you give it a bad named argument. I found that you can even feed it nonsense like

trace = pm.sample(4000,  tune=1000, abloogiwoogiwoo="the quick brown fox jumps over the lazy dog")

and it will happily go on sampling without complaint. What’s the reason behind this behaviour?

Yep, we definitively need some improvement here, see related Github issue: https://github.com/pymc-devs/pymc3/issues/3226

1 Like