ENH/BUG: Prediction diagnostics and bugfixes

This is a class wrapper/decorator that adds recording of diagnostic info to a predictor class (i.e. one implementing the prediction protocol). This allows inspection of the prediction calculations without degrading performance during normal use.

This class has been used to tune prediction parameters on real data, and to find bugs which are fixed by this PR. A test is included.