An Adaptive Approach to Learning Optimal Neighborhood Kernels