Machine learning learns patterns from data instead of following hand-written rules. The main split is by what the data contains. Supervised learning trains on labelled examples (inputs with correct outputs) and learns to predict labels for new inputs: classification predicts categories (spam or not spam), regression predicts numbers (house price). Unsupervised learning trains on unlabelled data and finds structure: clustering groups similar items, and dimensionality reduction finds compact representations. Reinforcement learning trains an agent by rewards and penalties from interacting with an environment, as in game playing.
Two failures frame all model evaluation. Overfitting means the model memorised the training data, including its noise: training accuracy is high, but test accuracy is low. Underfitting means the model is too simple to capture the pattern: both training and test accuracy are low. The remedies differ: overfitting is fought with more data, simpler models, regularisation (penalising large weights), and cross-validation; underfitting is fought with richer features or more expressive models. The bias-variance trade-off states the same idea formally: simple models have high bias and low variance, complex models have low bias and high variance, and the best model balances the two.
Worked example — reading a confusion matrix. A classifier tested on 100 patients gives: 60 true positives (sick, predicted sick), 40 false negatives (sick, predicted healthy), 30 true negatives and 10 false positives. Recall = TP / (TP + FN) = 60 / (60 + 40) = 0.60: the model catches 60% of sick patients. Precision = TP / (TP + FP) = 60 / (60 + 10) ≈ 0.857: when it says sick, it is right about 86% of the time. In medicine, recall matters more: missing a sick patient is worse than a false alarm. In spam filtering, precision matters more: losing a real email is worse than seeing one spam message. The metric follows the cost of each error.