Nonlinear Semi-Supervised And Unsupervised Metric Learning With Applications In Neuroimaging