implement of machine learning algorithm