Learning and Generalization for Matching Problems