Discriminative Metric Learning by Neighborhood Gerrymandering