Intro to Machine Learning Concepts

Machine learning is the practice of having a program learn a pattern from examples rather than being told the exact rule directly — and a handful of core ideas explain almost everything that follows from that.

Supervised vs. unsupervised learning

In supervised learning, you give the model examples that already include the correct answer — thousands of emails each labeled "spam" or "not spam" — and it learns a pattern that predicts the label for new, unlabeled emails. In unsupervised learning, there are no labels at all; the model instead looks for structure on its own, like grouping customers into segments based on their purchasing patterns without being told what the segments should be. Most of the everyday examples people picture — spam filters, price prediction, image recognition — are supervised.

Training data and test data

A model is never evaluated on the same data it learned from. The data gets split into a training set, which the model learns the pattern from, and a test set, held back entirely and used only afterward to check how well the model performs on examples it has never seen. Skipping this split and judging a model by how well it does on its own training data gives a badly inflated, unreliable picture of how it'll actually perform in the real world.

Overfitting: memorizing instead of learning

A model that fits its training data too closely can end up memorizing the noise and quirks specific to that exact dataset, rather than learning the general pattern underneath it. A wildly overfit model can score near-perfectly on its training data while performing badly on new data — because it learned the specific examples by heart instead of the underlying rule.

Why the test set matters so much: an overfit model looks fantastic right up until the moment you check it against data it hasn't memorized — which is exactly why the test set has to stay completely untouched during training. A model's performance on its own training data tells you almost nothing reliable about how it'll behave once it meets real, new data.