Lossy Compression for Lossless Prediction