A Model-to-data Approach for Building Accurate Machine Learning Algorithms on EHR Data