adding training method to machine learning