Adaptation for nearest neighbor