How does the machine learning algorithm work?