Deep Learning with Constraints and Priors for Improved Subject Clustering, Medical Imaging, and Robust Inference