Calibration and Discrimination Optimization Using Clusters of Learned Representation