Rewrite evaluation metrics

This completely rewrites the evaluation metric interface to make it easier to write and test metrics.