Parametric Local Metric Learning for Nearest Neighbor Classification