Local Distance Metric Learning for Nearest Neighbor Algorithm