Glossary

Machine learning, in plain English.

35 terms you'll meet in every course, job description and interview, each with an example and the mistake people most often make.

Accuracy

Accuracy is the share of predictions a classifier gets right.

It's easy to understand but misleading when classes are imbalanced, because predicting the common class every time can score highly.

Always compare accuracy with the majority-class baseline, and look at precision, recall and the confusion matrix too.

Example. A rule that flags messages containing "free" as spam scores 88.98% accuracy, but predicting "not spam" for everything already scores 86.60%.

Common mistake. Reporting accuracy on a dataset where one class is rare. A fraud model can be 99% accurate and catch nothing.

Go deeper: Accuracy is lying to you. Taught in Foundations of AI, Stage 5. Related: Baseline, Precision and recall, Confusion matrix

Baseline

A baseline is the simplest sensible prediction, used as the score a model must beat to be worth anything.

Common baselines are: always predict the most common class, always predict the average, predict the same as last time, or use the rule a team already uses.

A score only means something next to its baseline. 90% accuracy is impressive if the baseline is 50% and worthless if it's 92%.

Example. On a spam dataset where 86.6% of messages aren't spam, predicting "not spam" for everything scores 86.6% accuracy without reading a single message.

Common mistake. Reporting a model's score without the baseline, which hides whether the model learned anything.

Taught in Foundations of AI, Stage 5. Related: Accuracy, Precision and recall

Bias–variance trade-off

The bias–variance trade-off describes how simple models make consistent but systematic errors, while flexible models fit closely but vary a lot with the data.

Bias is error from wrong assumptions, such as assuming a straight line. Variance is error from being too sensitive to the particular training sample.

As a model gets more flexible, bias usually falls and variance rises. The goal is the level of flexibility with the lowest error on new data.

Example. A shallow tree has high bias and low variance. A very deep tree has low bias and high variance. A random forest averages many deep trees to cut variance.

Common mistake. Treating it as a law with one sweet spot for every problem. It's a way to diagnose errors: check training versus validation error to see which one dominates.

Go deeper: Overfitting vs underfitting. Taught in Foundations of AI, Stage 5. Related: Overfitting, Underfitting, Regularisation

Calibration

A model is well calibrated when its predicted probabilities match how often things actually happen: of all cases scored 0.7, about 70% are positive.

Many models rank well but give probabilities that are too extreme or too timid. A calibration curve compares predicted probabilities with observed frequencies.

Calibration matters whenever the probability itself drives a decision, such as pricing risk or deciding how much to spend on a customer.

Example. A model says 0.9 for 1,000 customers, but only 600 of them churn. It's overconfident and needs recalibrating.

Common mistake. Assuming a high AUC means good probabilities. Ranking and calibration are different properties.

Taught in Foundations of AI, Stage 13. Related: Logistic regression, Decision threshold, ROC curve and AUC

Classification

Classification is the kind of supervised learning that predicts a category, such as spam or not spam, or which of several products a customer will choose.

Most classifiers output a score or probability for each class, and a threshold turns that score into a decision. Binary classification has two classes; multiclass has more.

Accuracy is rarely enough to judge a classifier. Precision, recall and the confusion matrix show which mistakes it makes.

Example. Deciding whether a card transaction is fraudulent from its amount, location, time and merchant.

Common mistake. Using the default 0.5 threshold without asking what each kind of mistake costs.

Go deeper: Logistic regression from scratch. Taught in Foundations of AI, Stage 6. Related: Logistic regression, Precision and recall, Confusion matrix, Decision threshold

Clustering

Clustering groups similar examples together without using labels.

k-means places k centres and assigns each point to the nearest one, moving the centres until they settle. Other methods find clusters of any shape, or a hierarchy of clusters.

Choosing the number of clusters and judging the result requires care, because there's no right answer to compare against.

Example. Segmenting shoppers into groups such as "frequent, small baskets" and "rare, large baskets" to plan different campaigns.

Common mistake. Running k-means on unscaled features, so the feature with the biggest units decides the clusters.

Go deeper: Machine learning for unlabeled data. Taught in Foundations of AI, Stage 11. Related: Unsupervised learning, Feature scaling

Confusion matrix

A confusion matrix is a table that counts a classifier's predictions against the true classes: true positives, false positives, true negatives and false negatives.

Every classification metric, including accuracy, precision, recall and specificity, is a ratio of these counts.

It shows not just how often a model is wrong but how it's wrong, which is what you need to decide whether it's useful.

Example. Of 1,000 emails: 120 spam caught (TP), 15 spam missed (FN), 10 real emails flagged (FP), 855 real emails passed (TN).

Common mistake. Mixing up the axes. Libraries and textbooks don't all put actual and predicted on the same side, so label both every time.

Go deeper: Accuracy is lying to you. Taught in Foundations of AI, Stage 5. Related: Precision and recall, Accuracy, Decision threshold

Cross-validation

Cross-validation estimates how well a model generalises by training and testing it several times on different splits of the data.

In k-fold cross-validation the data is split into k parts. The model is trained on k − 1 parts and tested on the remaining one, k times, and the scores are averaged.

It gives a more stable estimate than a single split and shows how much the score varies. It's the standard way to compare models and tune settings without touching the test set.

Example. 5-fold cross-validation of a churn model gives five recall scores between 0.71 and 0.76, so you report about 0.73 with that spread.

Common mistake. Preprocessing (scaling, imputing) on the full dataset before cross-validation, which leaks information. Put preprocessing inside a pipeline.

Go deeper: Cross-validation with groups and time. Taught in Foundations of AI, Stage 5. Related: Train/test split, Pipeline, Data leakage, Hyperparameter

Data drift

Data drift is when the data a model sees in production changes from the data it was trained on, which can quietly make it worse.

Input drift is a change in the features, such as a new customer segment. Concept drift is a change in the relationship between features and label, such as fraudsters changing tactics.

Monitoring input distributions, prediction distributions and, once labels arrive, actual performance is how you catch it.

Example. A demand forecast trained before a major price change keeps predicting old buying patterns.

Common mistake. Monitoring only uptime and latency. A model can be up and fast while its predictions get steadily worse.

Taught in Foundations of AI, Stage 13. Related: Calibration, Baseline

Data leakage

Data leakage is when information that wouldn't be available at prediction time gets into training or validation, making a model look better than it really is.

Common causes: preprocessing on all the data before splitting, features that are consequences of the label, the same entity on both sides of a split, random splits on time-ordered data, and repeatedly tuning on the test set.

Leakage doesn't cause errors; it causes good numbers. If a score looks too good to be true, assume leakage until you've ruled it out.

Example. Predicting hospital readmission using a "discharge follow-up scheduled" field that's only filled in for patients already flagged as high risk.

Common mistake. Scaling or imputing on the full dataset before cross-validation. Fit every step inside a pipeline.

Go deeper: Data leakage in machine learning. Taught in Foundations of AI, Stage 9. Related: Pipeline, Cross-validation, Train/test split, Feature

Decision threshold

A decision threshold is the score above which a classifier's output is treated as a positive prediction.

Most classifiers output a score or probability. The threshold turns it into a yes or no. Moving it trades false positives for false negatives.

The best threshold depends on what each mistake costs and is chosen on validation data, not assumed to be 0.5.

Example. If a missed fraud costs ₹10,000 and a false alarm costs ₹200 of review time, the best threshold is much lower than 0.5.

Common mistake. Choosing the threshold on the test set, which makes the final score optimistic.

Go deeper: Accuracy is lying to you. Taught in Foundations of AI, Stage 5. Related: Precision and recall, ROC curve and AUC, Calibration

Decision tree

A decision tree predicts by asking a sequence of yes/no questions about the features, splitting the data at each step.

At each node, the tree picks the question that best separates the data, such as "is income above 50,000?". Leaves give the prediction.

Trees handle mixed feature types and non-linear patterns without scaling, but a single deep tree overfits easily. Ensembles of trees fix that.

Example. A loan model that first splits on credit history, then on income, then on existing debt.

Common mistake. Growing a tree without limits and trusting its training score.

Taught in Foundations of AI, Stage 10. Related: Random forest, Gradient boosting, Overfitting

Feature

A feature is one input to a model: a measurable property of each example, such as age, price or the number of times a word appears.

Models only see numbers, so every feature has to be turned into numbers: categories become indicator columns, text becomes word counts or embeddings, dates become day-of-week or time-since.

Good features often matter more than the choice of model. Creating them from domain knowledge is called feature engineering.

Example. For predicting churn: months as a customer, support tickets last month, and whether the customer changed plan recently.

Common mistake. Using a feature that wouldn't be known at prediction time. That's data leakage, and it makes a model look far better than it is.

Taught in Foundations of AI, Stage 2. Related: Label, Data leakage, Feature scaling, One-hot encoding

Feature scaling

Feature scaling puts features on comparable ranges, which many models need to train well and treat features fairly.

Standardisation subtracts the mean and divides by the standard deviation. Min–max scaling maps values to a fixed range such as 0 to 1.

Distance-based models (like k-nearest neighbours), regularised linear models and gradient descent are all sensitive to scale. Tree-based models are not.

Example. Income in rupees (tens of thousands) and age in years (tens) dominate a k-NN distance very differently until both are standardised.

Common mistake. Fitting the scaler on all the data before splitting. Fit it on training data only, inside a pipeline.

Go deeper: fit, transform and predict in scikit-learn. Taught in Foundations of AI, Stage 9. Related: Pipeline, Regularisation, Gradient descent

Gradient boosting

Gradient boosting builds an ensemble of small trees one at a time, each correcting the errors of the ones before it.

Each new tree is fitted to what the current ensemble still gets wrong, and added with a small weight (the learning rate). Libraries like XGBoost and LightGBM are fast implementations.

It's usually the most accurate approach for tabular data, but it has more hyperparameters than a random forest and can overfit if trained too long.

Example. A credit-risk model with 400 shallow trees, stopped early when validation loss stops improving.

Common mistake. Training for a fixed large number of rounds without early stopping on a validation set.

Taught in Foundations of AI, Stage 10. Related: Decision tree, Random forest, Learning rate

Gradient descent

Gradient descent trains a model by repeatedly nudging its parameters in the direction that reduces the loss the fastest.

The gradient is the direction in which the loss increases most steeply. Gradient descent takes a small step the opposite way, recomputes the gradient, and repeats until the loss stops falling.

The size of each step is the learning rate. Too large and training overshoots or diverges; too small and it takes forever.

Example. Training linear regression from scratch: start with random weights, compute how the mean squared error changes with each weight, and update every weight a little, thousands of times.

Common mistake. Forgetting to scale features. With features on very different scales, gradient descent zig-zags and converges slowly.

Go deeper: Logistic regression from scratch. Taught in Foundations of AI, Stage 4. Related: Loss function, Learning rate, Linear regression, Feature scaling

Hyperparameter

A hyperparameter is a setting you choose before training, such as the learning rate or a tree's maximum depth, rather than something the model learns.

Parameters (like regression weights) are learned from data. Hyperparameters control how that learning happens and are chosen by comparing validation scores.

Grid search and random search try many combinations with cross-validation. The test set should play no part in choosing them.

Example. Trying maximum tree depths of 3, 5, 8 and 12 with 5-fold cross-validation and choosing 5.

Common mistake. Tuning hyperparameters on the test set, which makes the final score optimistic.

Go deeper: scikit-learn interview questions. Taught in Foundations of AI, Stage 5. Related: Cross-validation, Learning rate, Regularisation

Label

A label is the answer a supervised model learns to predict, such as the price of a house or whether an email is spam.

Labels come from history (what actually happened), from people (who marked examples by hand) or from another system. Their quality limits the model's quality.

Defining the label precisely is one of the most important decisions in a project. "Churned" could mean cancelled, stopped paying, or inactive for 30 days, and each gives a different model.

Example. In a spam dataset, each message's label is "spam" or "not spam".

Common mistake. Letting the label definition drift during a project, so training and evaluation measure different things.

Taught in Foundations of AI, Stage 2. Related: Feature, Supervised learning

Learning rate

The learning rate controls how big a step gradient descent takes on each update.

It's one of the most important hyperparameters in any model trained by gradient descent, from linear regression to deep neural networks.

Plotting the loss over training steps shows whether it's right: smoothly falling is good, flat means too small, and jumping or exploding means too large.

Example. With a learning rate of 0.001 the loss falls slowly over 10,000 steps; with 0.1 it converges in 200; with 2 it blows up.

Common mistake. Changing the learning rate and the number of steps at the same time, then not knowing which one helped.

Taught in Foundations of AI, Stage 4. Related: Gradient descent, Hyperparameter

Linear regression

Linear regression predicts a number as a weighted sum of the features plus a constant, choosing the weights that minimise squared error.

Each weight says how much the prediction changes when that feature goes up by one unit, holding the others fixed. The weights can be found exactly with linear algebra or iteratively with gradient descent.

It's simple, fast and interpretable, and it's the foundation for understanding most other models.

Example. Predicted price = 50,000 + 3,000 × (size in square metres) − 1,000 × (age in years).

Common mistake. Reading weights as importance when features are on different scales or strongly correlated.

Go deeper: Linear regression in machine learning. Taught in Foundations of AI, Stage 4. Related: Regression, Gradient descent, Regularisation, Logistic regression

Logistic regression

Logistic regression is a classification model that turns a weighted sum of features into a probability between 0 and 1.

It computes a linear score like linear regression, then passes it through the sigmoid function to get a probability. It's trained by minimising log loss.

Each weight changes the log-odds of the positive class. It's a strong, interpretable baseline for many classification problems.

Example. Estimating the probability that a customer will cancel next month from their usage and support history.

Common mistake. Treating the output as a well-calibrated probability without checking. Regularisation and imbalance can distort it.

Go deeper: Logistic regression from scratch. Taught in Foundations of AI, Stage 6. Related: Classification, Linear regression, Decision threshold, Calibration

Loss function

A loss function measures how wrong a model's predictions are, giving training a single number to make as small as possible.

Regression often uses mean squared error, which punishes large errors heavily. Classification often uses log loss (cross-entropy), which punishes confident wrong predictions.

The loss you train on isn't always the metric you care about. You might train with log loss but judge the model on recall at a chosen threshold.

Example. If a model predicts 210 for a true value of 200, the squared error for that example is 100.

Common mistake. Assuming the loss and the business metric are the same thing. Check the metric that matches the decision.

Go deeper: Logistic regression from scratch. Taught in Foundations of AI, Stage 4. Related: Gradient descent, Regression, Classification

Machine learning

Machine learning is a way of building software that learns patterns from examples instead of following rules a person wrote by hand.

In ordinary programming you write the rules: if the message contains these words, mark it as spam. In machine learning you give the computer many examples, each with the right answer, and an algorithm finds the rules that best reproduce those answers.

Most machine learning is one of three kinds. Regression predicts a number. Classification predicts a category. Unsupervised learning finds structure, such as groups, in data with no answers at all.

Example. Instead of hand-writing rules for spam, you show a model 5,000 labelled messages and it learns which words and patterns make spam more likely.

Common mistake. Thinking machine learning is mostly about choosing algorithms. Most of the work is framing the problem, preparing data and checking honestly whether the model works.

Go deeper: Where to start with machine learning. Taught in Foundations of AI, Stage 2. Related: Supervised learning, Unsupervised learning, Feature, Label

One-hot encoding

One-hot encoding turns a category into a set of 0/1 columns, one for each possible value.

Models need numbers, but giving categories arbitrary numbers (red = 1, blue = 2) implies an order that doesn't exist. One-hot encoding avoids that.

Categories with thousands of values create thousands of columns, so rare values are often grouped, or other encodings are used.

Example. A "city" column with Delhi, Mumbai and Pune becomes three columns: city_Delhi, city_Mumbai, city_Pune.

Common mistake. Not handling categories that appear in new data but not in training. Set the encoder to ignore unknown values.

Taught in Foundations of AI, Stage 9. Related: Feature, Pipeline

Overfitting

Overfitting is when a model learns the noise and quirks of its training data so closely that it performs worse on new data.

An overfit model has a much better training score than validation score. It has memorised rather than generalised.

It's more likely with flexible models, many features and little data. Regularisation, simpler models, more data and early stopping all help.

Example. A decision tree grown until every leaf is pure scores 100% on training data and 71% on new data.

Common mistake. Only checking the training score. Always compare training and validation performance.

Go deeper: Overfitting vs underfitting. Taught in Foundations of AI, Stage 5. Related: Underfitting, Bias–variance trade-off, Regularisation, Cross-validation

Pipeline

A pipeline chains preprocessing steps and a model into one object, so they're fitted together and applied the same way every time.

In scikit-learn, a Pipeline fits each step on the training data only and applies it to new data. Cross-validating the whole pipeline prevents preprocessing leakage by construction.

Pipelines also make models reproducible and easier to deploy, because the exact same transformations run in production.

Example. make_pipeline(SimpleImputer(), StandardScaler(), LogisticRegression()) passed to cross_val_score.

Common mistake. Fitting a scaler outside the pipeline "just once" for convenience, which reintroduces leakage.

Go deeper: fit, transform and predict in scikit-learn. Taught in Foundations of AI, Stage 9. Related: Data leakage, Cross-validation, Feature scaling

Precision and recall

Precision is the share of flagged items that are truly positive; recall is the share of truly positive items that get flagged.

Precision = TP / (TP + FP). Recall = TP / (TP + FN). Raising the threshold usually increases precision and lowers recall, and the reverse.

Which matters more depends on the cost of each mistake. Screening for a serious disease favours recall; a spam filter that must not lose real email favours precision. The F1 score combines both into one number.

Example. A fraud model flags 100 transactions, 80 of which are fraud (precision 0.8). There were 200 frauds in total, so it caught 80 of them (recall 0.4).

Common mistake. Reporting one without the other. A model that flags everything has perfect recall and is useless.

Go deeper: Accuracy is lying to you. Taught in Foundations of AI, Stage 5. Related: Confusion matrix, Decision threshold, Accuracy, ROC curve and AUC

Random forest

A random forest averages the predictions of many decision trees, each trained on a random sample of the data and features.

Each tree overfits in a different way, and averaging cancels much of that variance. The randomness in rows and features keeps the trees from all being the same.

Random forests are strong, robust defaults for tabular data and need little tuning.

Example. 500 trees each vote on whether a transaction is fraud, and the forest reports the share that said yes.

Common mistake. Reading its built-in feature importance as truth. It's biased towards features with many distinct values; permutation importance is more reliable.

Taught in Foundations of AI, Stage 10. Related: Decision tree, Gradient boosting, Bias–variance trade-off

Regression

Regression is the kind of supervised learning that predicts a number, such as a price, a temperature or the time until an event.

A regression model maps features to a continuous output. Linear regression, the simplest, predicts a weighted sum of the features plus a constant.

Regression models are usually judged by how far their predictions are from the truth, with metrics like mean absolute error or root mean squared error.

Example. Predicting next week's sales for each store from past sales, promotions and holidays.

Common mistake. Confusing the name with the technique: logistic regression is actually a classification method.

Go deeper: Regression models in machine learning. Taught in Foundations of AI, Stage 4. Related: Linear regression, Loss function, Supervised learning

Regularisation

Regularisation adds a penalty for model complexity during training, which reduces overfitting.

In linear models, L2 regularisation (ridge) penalises large weights and shrinks them towards zero. L1 (lasso) can set some weights exactly to zero, which also selects features.

The strength of the penalty is a hyperparameter, chosen with cross-validation. Features should be on similar scales, or the penalty treats them unfairly.

Example. A ridge regression with many correlated features gives smaller, more stable coefficients and better validation error than plain linear regression.

Common mistake. Regularising without scaling features first, so features measured in large units are barely penalised.

Taught in Foundations of AI, Stage 5. Related: Overfitting, Feature scaling, Hyperparameter, Linear regression

ROC curve and AUC

An ROC curve plots the true positive rate against the false positive rate at every threshold; the AUC summarises it as one number.

The AUC is the probability that the model scores a random positive example higher than a random negative one. 0.5 is random guessing; 1.0 is perfect ranking.

ROC curves can look good on very imbalanced data even when precision is poor, so precision–recall curves are often more informative for rare classes.

Example. A churn model with an AUC of 0.82 ranks a random churner above a random non-churner 82% of the time.

Common mistake. Treating a high AUC as proof the model is useful at your chosen threshold. AUC measures ranking, not the decisions you'll make.

Taught in Foundations of AI, Stage 5. Related: Precision and recall, Decision threshold, Classification

Supervised learning

Supervised learning trains a model on examples that come with the correct answer, so it can predict that answer for new examples.

Each training example has inputs (features) and an output (the label). The model adjusts itself until its predictions match the labels as closely as possible, then you check how well it does on examples it hasn't seen.

If the label is a number, it's regression. If the label is a category, it's classification.

Example. Predicting a house's price from its size, location and age, trained on past sales where the price is known.

Common mistake. Assuming labels are correct. Labels are often noisy, delayed or defined inconsistently, and the model learns whatever they say.

Taught in Foundations of AI, Stage 2. Related: Regression, Classification, Label, Feature

Train/test split

A train/test split holds back part of the data so you can measure how a model performs on examples it never saw during training.

The model learns from the training set. The test set stays untouched until the end, giving an honest estimate of performance on new data.

If you use the test set to make decisions (choosing features, tuning settings), it stops being an honest estimate. That's why a separate validation set or cross-validation is used for tuning.

Example. Training on 80% of past loan applications and measuring accuracy on the other 20%.

Common mistake. Splitting randomly when time matters, or when the same customer appears in many rows. Both leak information across the split.

Go deeper: Data leakage in machine learning. Taught in Foundations of AI, Stage 5. Related: Cross-validation, Overfitting, Data leakage

Underfitting

Underfitting is when a model is too simple to capture the real pattern in the data, so it performs poorly even on its training data.

An underfit model has low training and validation scores that are close to each other. It hasn't learned enough.

The fixes go the other way from overfitting: more informative features, a more flexible model, or less regularisation.

Example. Fitting a straight line to data that clearly curves, so the predictions are off everywhere.

Common mistake. Adding more data to fix underfitting. More data helps an overfit model; an underfit one needs more capacity or better features.

Go deeper: Overfitting vs underfitting. Taught in Foundations of AI, Stage 5. Related: Overfitting, Bias–variance trade-off

Unsupervised learning

Unsupervised learning finds structure in data that has no labels, such as groups of similar items or a simpler way to represent the data.

There's no right answer to learn from. Instead the algorithm looks for patterns: clusters of similar customers, directions in which the data varies most, or items that don't fit the rest.

Because there's no label, judging the result is harder. You usually check whether the structure is stable and whether it's useful for a decision.

Example. Grouping customers by purchasing behaviour to design different offers, without anyone labelling the groups in advance.

Common mistake. Treating clusters as natural facts. Most algorithms will always find clusters, even in random data. Check that they're stable and meaningful.

Go deeper: Machine learning for unlabeled data. Taught in Foundations of AI, Stage 11. Related: Clustering, Machine learning

First Principles, the SchoolWhool newsletter

One machine learning idea, explained properly, every week.

The intuition, the common mistake, and a five-minute way to try it yourself. Written by Gaurav.