Distance Metric Learning for Large Margin Nearest Neighbor Classification