โ† Machine Learning Primer

Supervised Learning

~320 words ยท 2 min read

Learning from labeled examples

In supervised learning, you train a model on data where the correct answer is already known. The model learns the mapping from inputs to outputs, then applies it to new, unseen data.

Two flavors

  • Classification โ€” the output is a category. Is this email spam or ham? Is this tumor malignant or benign?
  • Regression โ€” the output is a number. What will the house sell for? How many users will sign up tomorrow?

Common algorithms

  • Linear regression โ€” fits a line (or hyperplane) to predict a continuous value.
  • Logistic regression โ€” classification cousin; outputs a probability.
  • Decision trees โ€” a flowchart of if/then splits; easy to interpret.
  • Random forests / gradient boosting โ€” ensembles of trees; powerful and widely used.

The train/test split

You never evaluate a model on the same data it learned from โ€” it would just memorize. Instead you split your data:

Training set  โ†’ teach the model (e.g. 80%)
Test set       โ†’ evaluate it on unseen data (e.g. 20%)
The test set is your honest judge. It must never influence training โ€” not even indirectly, through model selection. Touch it once, at the very end.

Overfitting

A model overfits when it memorizes the training data โ€” including its noise โ€” and fails to generalize. Symptoms: near-perfect training accuracy but poor test accuracy. Combat it with simpler models, more data, regularization, or cross-validation.