A discriminative modeling approach for inferring ancestry and correcting phase in large population genetics data sets