Learning High-Density Regions for a Generalized Kolmogorov-Smirnov Test in High-Dimensional Data