Robust Spectral Detection of Global Structures in the Data by Learning a Regularization