How to unit test machine learning code.

Edit: The popularity of this post has inspired me to write a machine learning test library. Go check it out!