Unit Testing Machine Learning Code

You may not appreciate the irony, but basically what you have there is legacy code: a chunk of software without any unit tests. Naturally you don’t know where to begin. So you may find it helpful to read up on handling legacy code.

The definitive thought on this is Michael Feather’s book, Working Effectively with Legacy Code. There used to be a helpful summary​ of that on the ObjectMentor site, but alas the website has gone the way of the company. However WELC has left a legacy in reviews and other articles. Check them out (or just buy the book), although the key lessons are the ones which S.Lott and tvanfosson cover in their replies.


2019 update: I have fixed the link to the WELC summary with a version from the Wayback Machine web archive (thanks @milia).

Also – and despite knowing that answers which comprise mainly links to other sites are low quality answers 🙂 – here is a link to a new (2019 new) Google tutorial on Testing and Debugging ML code. I hope this will be of illumination to future Seekers who stumble across this answer.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)