Misc functions for training and plotting classification and regression models.