Machine learning algorithm principle and programming practice