[SciPy-dev] Unit Tests for Probabilistic Functions

Dennis V. Perepelitsa dvp at mwl.MIT.EDU
Fri Jul 21 07:23:39 CDT 2006


Hi, all.

I'm in the process of writing unit tests for a hidden markov model
module I've been hacking on. I want to ensure that my implementation
generates sequences of hidden and observed states with the correct
probabilities. How can I test for this?

More generally, what are some good methods to use when writing unit
tests for probabilistic functions? Can we do any better than "run it a
bunch of times and make sure the true mean is within a 98% (or
higher/lower) confidence interval of the sample mean"? I'd rather not
devise a unit test that is guaranteed to fail 2% of the time. 

Dennis V. Perepelitsa
Picower Institute for Learning and Memory
MIT, Class of 2008 - Course VIII, XVIII



More information about the Scipy-dev mailing list