Machine Learning Caret based helper code