1st commit for sampling code with learning and x-validation sets