python code for simple machine learning algorithms