Machine learning algorithms build a mathematical model based on sample data, known as "training data", in order to make predictions or decisions without being explicitly programmed to perform the task. The data is analyzed and patterns are detected, allowing the algorithm to learn from the data and make an assessment or prediction about new data. Supervised learning is when the training data contains the desired solutions, allowing the algorithm to learn from labeled examples, while unsupervised learning is when solutions are not presented to the algorithm during the training.