Python machine learning algorithm for data analysis