Stats & MLVisual glossary
Home

Statistics &
machine learning

A visual glossary of 235 concepts in 16 topics. Each entry gives a plain-English line, the business question it answers, a common trap, and the precise definition, beside a chart or worked example.

A fraud detector catches 90% of fraud and false-alarms on 5% of legitimate payments. How trustworthy is an alert? It depends on how rare fraud is.

Real fraudFalse alarms
235 terms in 16 topics

Guides and choosers

6 guides
A–Z index of all 235 terms

Which test should I use?

Start from the quantity you want to learn about, not from the shape of the data. A rank-based test is not “the same test for skewed data”: it asks whether one group tends to have higher values, which is a different question from whether its mean or its median is higher, and the answers can disagree. Skewed revenue is still a number, and skew alone does not rule out a t-test. Then say how the data were collected, and which assumption holds. “Separate groups” means different, unrelated units in each group. Running many tests calls for a multiple-comparisons correction.

Welch's t-test
Tests
H₀: the two population means are equal.
Check
Independent groups and independent observations within each. It does not assume equal spread. It needs the two sample means to be close to normal: skewed revenue is still a number, and skew alone does not rule this test out.
Show the full tables
DesignTarget: a meanTarget: a medianTarget: which group tends to be higher (rank-based)Target: a proportion or category mix
Two separate groups
Welch's t-testModerate or large samples, no extreme values
Permutation test or bootstrap interval for the difference in meansSmall samples with heavy skew or extreme values
Mann–Whitney U testThe two distributions have the same shape and differ only by a shift
Fisher's exact testAny expected count below about 5
Chi-square test of independenceThree or more outcome categories
One group against a benchmark
One-sample t-testModerate or large sample, no extreme values
Bootstrap interval for the meanSmall sample with heavy skew or extreme values
One-sample z-testThe population standard deviation is known
Sign testNo assumption about shape
Wilcoxon signed-rank testThe distribution is roughly symmetric
Sign testOnly above or below the benchmark is meaningful (ordinal ratings)
Wilcoxon signed-rank testThe differences are meaningful in size and roughly symmetric
One-proportion z-testYes/no outcome, large counts
Exact binomial testYes/no outcome, small counts
Chi-square goodness-of-fit testThree or more categories
The same units measured twice
Paired t-testModerate or large number of pairs, no extreme differences
Wilcoxon signed-rank testFew pairs; differences symmetric but with outliers
Bootstrap interval for the mean differenceFew pairs; differences heavily skewed
Wilcoxon signed-rank testThe differences are roughly symmetric
Sign test on the within-pair changesOnly better or worse is meaningful (ordinal ratings)
Wilcoxon signed-rank testThe changes are meaningful in size and roughly symmetric
McNemar's testYes/no outcome
Stuart–Maxwell test of marginal homogeneityThree or more categories
Three or more separate groups
Welch's ANOVAGroup spreads may differ (safer default)
One-way ANOVAGroup spreads are similar
Mood's median testNo assumption about shape
Kruskal–Wallis testAll groups share one shape and differ only by shifts
The same units measured three or more times
Mixed-effects modelMissing visits, unequal timing, or other predictors to include
Repeated-measures ANOVAComplete data at the same occasions for every unit
Median (quantile) regression with unit-level resampling
Cochran's Q testYes/no outcome
Relationship between…MethodWhat the first option tests
Two numeric variables, straight-line associationH₀: the population linear correlation is zero.
Two numeric or ordinal variables, any consistently rising or falling association
Kendall's tauMany ties or a small sample
H₀: no monotonic association between the two variables.
Two categorical variables
Fisher's exact testSparse expected counts
H₀: the two categorical variables are independent.
A numeric outcome with one or more predictors
Linear regressionIndependent observations
Mixed-effects modelObservations grouped or repeated (stores, customers, visits)
For each predictor, H₀: its coefficient is zero with the other predictors held fixed. Predictors may be numeric, categorical, or a mixture.
A yes/no outcome with one or more predictorsFor each predictor, H₀: its coefficient is zero on the log-odds scale. Predictors may be numeric, categorical, or a mixture.
An outcome with three or more categories, with predictors
Multinomial logistic regressionThe categories have no order
Ordinal (proportional-odds) logistic regressionThe categories are ordered
How predictors change the odds of each category relative to a reference category.
A count outcome with one or more predictors
Poisson regressionVariance close to the mean
Negative binomial regressionVariance well above the mean (overdispersion)
For each predictor, H₀: its coefficient is zero on the log scale of the expected count.
A numeric outcome compared across categories
A comparison of group means
This is the “average” target with two or more groups.

Where a cell lists several methods, the small print under each gives the condition that selects it. The chooser above also states what each one tests and what to check.

Which metric should I report?

Choose the metric that matches what a mistake costs. Whichever you report, state the baseline it is being compared with.

If…Lead withBecause
Classes are roughly balanced and both kinds of error cost about the sameAccuracySimple and honest when neither class is rare.
False alarms are expensive, such as blocking good customersPrecisionMeasures how trustworthy a flag is.
Misses are expensive, such as undetected fraudRecallMeasures how much of the problem you catch.
You need one number for a rare classF1 ScoreHigh only when precision and recall are both high.
You are comparing models before fixing a thresholdArea Under the Curve (AUC) or ROC CurveJudges ranking quality across all thresholds.
Predicted probabilities feed pricing, staffing, or riskCalibrationA reliability diagram checks that events given 70% really happen about 70% of the time.
You need one overall score for probability forecastsCross-entropyRewards both calibration and telling cases apart, so it cannot isolate either.
Forecasting: typical miss in the original unitsMean Absolute Error (MAE)Easy to explain; every unit of error counts the same.
Forecasting: large misses are disproportionately costlyRoot Mean Square ErrorWeights big errors more heavily.
Forecasting: comparing products of very different sizeMean Absolute Percentage Error (MAPE)Unit-free, but unreliable for low-volume items.
Explaining how much variation a model accounts forR-squaredA description of fit, not a guarantee of prediction quality.

A machine-learning project, start to finish

The seven stages most projects pass through, with the entries that matter most at each one. Fixed clean-up, such as converting units, can happen at any point. Any step that learns from the records must come after the split and be fitted inside each training portion, then applied to the held-out rows; otherwise test information leaks into the model.

  1. Frame the questionSupervised LearningClassificationRegression
  2. Split it honestlyBefore anything is learned from the data.Train–Test SplitValidation SetData Leakage
  3. Prepare the dataFit imputation, scaling and feature selection on training rows only.Data Pre-processingMissing ValuesFeature Engineering
  4. TrainLoss FunctionGradient DescentHyperparameter
  5. TuneCross-validationOverfittingRegularization
  6. EvaluateModel EvaluationConfusion MatrixCalibration
  7. Deploy and monitorInferenceData DriftHuman in the Loop

Always plot the data first

These four datasets, known as Anscombe’s quartet, share the same averages, the same spread, the same fitted line, and the same correlation of 0.82. Only a chart shows that B is a curve, C has one outlier bending the line, and D’s relationship rests on a single point.

Anscombe's quartetFour scatter plots with identical means, variances, correlation of 0.82 and fitted line: a linear cloud, a curve, a line with one outlier, and a vertical stack with one far point. 5 10 15 20 4 8 12 Dataset A 5 10 15 20 Dataset B 5 10 15 20 Dataset C 5 10 15 20 Dataset D

How to read a regression table

An illustrative model of weekly sales ($k) for 52 weeks, as most statistics packages print it. The numbered markers explain each column.

Outcome: weekly sales ($k) · n = 52 · R² = 0.846
TermCoefficient1Std. error2t3p495% interval5
Intercept61.1010.885.62< 0.00139.24 to 82.97
Ad spend ($k)3.210.2015.88< 0.0012.81 to 3.62
Price ($)-4.271.03-4.13< 0.001-6.34 to -2.19
  • 1Coefficient. Each extra $1k of ad spend goes with about $3.2k more weekly sales, with price held fixed. See Multiple Linear Regression.
  • 2Standard error. How much the coefficient would wobble from sample to sample. See Standard Error.
  • 3t value. The coefficient divided by its standard error: how many standard errors it sits from zero.
  • 4p-value. How surprising a coefficient this far from zero would be if the true effect were nil. See P-value.
  • 595% interval. A range of coefficient values compatible with the data. When every value in it has the same sign, the matching two-sided test rejects a zero coefficient at the 5% level, under the model’s assumptions. See Confidence Interval.
  • 6R-squared. The model accounts for 84% of the week-to-week variation in sales. See R-squared.

How to read a classification report

The standard printout for a yes/no model, built here from the same 20 test cases as the confusion matrix entry (6 true positives, 2 misses, 3 false alarms, 9 true negatives).

ClassPrecision1Recall2F13Support4
Positive (churned)0.670.750.718
Negative (stayed)0.820.750.7812
Accuracy50.7520
Macro average60.740.750.7420
  • 1Precision. Of the customers flagged as churners, 67% really churned. See Precision.
  • 2Recall. Of the customers who churned, the model caught 75%. See Recall.
  • 3F1. One number that is high only when precision and recall both are. See F1 Score.
  • 4Support. How many real cases of each class were tested. Small support means shaky figures.
  • 5Accuracy. The share of all 20 predictions that were right. Misleading when one class is rare. See Accuracy.
  • 6Macro average. The plain average across classes, so a rare class counts as much as a common one.

Data and descriptive statistics

21 terms
Terms in this topic

Population

The complete group you want to draw conclusions about.

Answers
Exactly who or what does this result apply to?
Watch out
The population is defined by the question, not by whichever records happen to be in the database.
Precise definition

A population is the full set of units or possible observations about which an analysis seeks to draw conclusions. It can be a finite collection, such as all beds in a farm, or a conceptual process that could generate future observations.

Often confused with Sample

Define the group of interest
Define the group of interestIf the target is all 40 beds at one farm this cycle, every dot belongs to the population.
If the target is all 40 beds at one farm this cycle, every dot belongs to the population.

Sample

The part of the population you actually measured.

Answers
What data do we really have, and how was it chosen?
Watch out
A big sample is not automatically a representative one; how it was selected matters more than its size.
Think of it as
Tasting a spoonful of soup: it tells you about the pot only if the pot was stirred.
Precise definition

A sample is the subset of units or observations actually collected for an analysis. How it was selected affects whether estimates from it can reasonably describe the intended population.

Often confused with Population

Select eight of the forty beds
Select eight of the forty bedsThe eight dark dots are observed beds. They supply the sample used to estimate features of the larger population.
The eight dark dots are observed beds. They supply the sample used to estimate features of the larger population.

Parameter

A fixed number that defines a population or a model, such as the true average or a model's weight.

Answers
What quantity are we trying to estimate or learn?
Watch out
A parameter is the unknown truth; the number computed from a sample is only an estimate of it.
Precise definition

A parameter is a quantity that defines a population or model, such as a population mean, regression coefficient, or neural-network weight. Parameters are typically estimated from data, whereas hyperparameters specify aspects of the model or training process and are usually chosen separately.

Often confused with Hyperparameter

Change the population mean
Change the population meanThese normal populations share standard deviation 1. Changing the mean parameter moves the whole distribution. -4 -2 0 2 4 Value 0.00 0.15 0.30 Density μ = −1 μ = +1
These normal populations share standard deviation 1. Changing the mean parameter moves the whole distribution.

Descriptive Statistics

Numbers and charts that summarize the data you have, without claims beyond it.

Answers
What does our data look like: typical value, spread, shape?
Watch out
A summary describes this dataset only; generalizing to other customers or periods needs inference.
Precise definition

Descriptive statistics summarize the data actually observed through numerical measures, tables, and plots. Examples include means, medians, standard deviations, and histograms, without necessarily making claims about a wider population.

See also Standard Deviation, Histogram

A batch of 13 observations
A batch of 13 observationsThe tallest bar marks the most frequent value, 3. The dashed line marks the mean, which is also 3 in this sample. 1 2 3 4 5 Observed value 0 1 2 3 4 5 Count
The tallest bar marks the most frequent value, 3. The dashed line marks the mean, which is also 3 in this sample.

Measures of Central Tendency

Different ways of naming one "typical" value: mean, median, and mode.

Answers
Which single number best represents this group?
Watch out
The three can disagree sharply on skewed data such as incomes or order sizes; say which one you used.
Precise definition

Measures of central tendency describe a typical or central value of a distribution. The mean, median, and mode emphasize different aspects of the data, so their usefulness depends on the variable type, distribution shape, and purpose of the analysis.

Three ways to summarize one sample
Three ways to summarize one sampleIn the ordered sample 1, 1, 2, 3, 8, the high value pulls the mean above the median.MeanMedianMode15 ÷ 5 = 3Middle = 2Most frequent = 1
In the ordered sample 1, 1, 2, 3, 8, the high value pulls the mean above the median.

Mean

The ordinary average: add the values up and divide by how many there are.

Answers
What is the typical value per customer, order, or day, and what total does that imply?
Watch out
A few very large values pull it up, so it can sit far from what most cases look like.
Think of it as
Pool everything and share it out equally.
Precise definition

The arithmetic mean is the sum of observed values divided by their number. It uses every value and is sensitive to extreme observations, which can pull it away from the center of most of the data.

Often confused with Median

Try the mean vs median slider ↗

Share the total evenly
Share the total evenlyThe three values sum to 12. Redistributing those 12 units equally gives a mean of 4.Observed237Even share444
The three values sum to 12. Redistributing those 12 units equally gives a mean of 4.

Median

The middle value when the data are sorted: at least half the values are at or below it, and at least half are at or above it.

Answers
What does the typical customer or order look like when a few are very large?
Watch out
It ignores how big the extremes are, so it cannot be multiplied by the count to recover a total.
Precise definition

The median is the 50th percentile, separating the lower and upper halves of an ordered distribution. For an even-sized numerical sample it is commonly calculated as the average of the two middle values, and it is less sensitive to extreme observations than the mean.

Often confused with Mean · See also Percentile

The middle observation
The middle observationOnce the five values are sorted, two lie on either side of 6. Increasing the largest value leaves the median at 6.Sorted246711After change246799
Once the five values are sorted, two lie on either side of 6. Increasing the largest value leaves the median at 6.

Mode

The most common value or category.

Answers
Which option is chosen most often, such as the best-selling size or the usual complaint type?
Watch out
The most common value may still be a small minority of cases, and there can be more than one.
Precise definition

The mode is the most frequent value or category in a dataset, or a point where a continuous probability density reaches a peak. A distribution can have more than one mode, and the mode is meaningful for categorical data where an arithmetic mean may not be.

The most frequent variety
The most frequent varietyBibb appears five times, more often than either other category. The mode is Bibb. Bibb Romaine Oakleaf 0 1 2 3 4 5 Count
Bibb appears five times, more often than either other category. The mode is Bibb.

Histogram

A bar chart showing how many values fall into each range.

Answers
What shape is our data: one peak or two, symmetric or skewed, any gaps?
Watch out
Changing the bin width can change the apparent shape, and it is not a bar chart of categories.
Precise definition

A histogram shows the distribution of a numerical variable by dividing its range into intervals, called bins, and drawing a bar for each. With equal-width bins, as here, bar height gives the count or share of observations; in a density histogram it is the bar's area that gives the share, so with unequal widths a taller bar can hold fewer observations. The apparent shape depends on the bin width and boundaries, so it is worth trying more than one choice.

Often confused with Box Plot

Count the orders in each $20 bin
Count the orders in each $20 binTwo hundred order values grouped into $20 bins. The tallest bar is the $40–$60 bin with 84 orders, and a thin tail of larger orders stretches to the right. 0 40 80 120 160 200 Order value ($) 0 20 40 60 80 Number of orders
Two hundred order values grouped into $20 bins. The tallest bar is the $40–$60 bin with 84 orders, and a thin tail of larger orders stretches to the right.

Variance

The average squared distance from the mean: the standard deviation squared.

Answers
How much variability is there, in a form that can be added up across independent sources?
Watch out
Its units are squared (dollars squared), so use the standard deviation when describing spread to people.
Precise definition

Variance is the expected squared deviation of a random variable from its mean, measuring spread in squared units. For independent observations from a common population with finite variance, dividing the sum of squared deviations from the sample mean by n − 1 gives an unbiased estimator of population variance.

See also Standard Deviation, Random Variable

Square the deviations before averaging
Square the deviations before averagingThe squared deviations sum to 8. Treating the three values as the whole population divides by n: 8 / 3 ≈ 2.67. Treating them as a sample divides by n − 1 instead: 8 / 2 = 4. Both are in squared units.ValueDeviation from 4Squared deviation2−244006+24
The squared deviations sum to 8. Treating the three values as the whole population divides by n: 8 / 3 ≈ 2.67. Treating them as a sample divides by n − 1 instead: 8 / 2 = 4. Both are in squared units.

Standard Deviation

The typical distance of individual values from the average.

Answers
How much do individual results vary around the average?
Watch out
It describes variation between individuals, not uncertainty about the average; that is the standard error.
Think of it as
The spread of individual heights in a room, as opposed to how precisely you know the room's average height.
Precise definition

Standard deviation is the square root of variance and measures spread in the same units as the observations. It describes variability among values, whereas the standard error describes uncertainty in an estimated statistic.

Often confused with Standard Error · See also Variance

The 68–95–99.7 rule
The 68–95–99.7 ruleFor a normal distribution, about 68% of values lie within one standard deviation of the mean, 95% within two, and 99.7% within three. Distributions with other shapes follow different percentages. −3 SD −2 SD −1 SD mean +1 SD +2 SD +3 SD Distance from the mean 0.0 0.1 0.2 0.3 0.4 Density 68% 95% 99.7%
For a normal distribution, about 68% of values lie within one standard deviation of the mean, 95% within two, and 99.7% within three. Distributions with other shapes follow different percentages.

Z-score

How many standard deviations a value sits above or below the average.

Answers
How unusual is this result compared with normal variation?
Watch out
A z-score of 2 means "top 2.5%" only if the data are roughly normal.
Precise definition

A z-score expresses how far a value is from a reference mean in units of the reference standard deviation: z = (x − μ) / σ. Standardizing values this way does not make their distribution normal, so normal-tail probabilities require an additional distributional justification.

See also Standard Deviation

Convert grams to standard deviations
Convert grams to standard deviationsWith mean 150 g and standard deviation 10 g, a 170 g plant lies two standard deviations above the mean.170 gObservation170 − 15020 g above mean20 ÷ 10z = +2
With mean 150 g and standard deviation 10 g, a 170 g plant lies two standard deviations above the mean.

Quantile

A cut point that splits sorted data at a chosen fraction, such as the value at or below which 75% of cases fall.

Answers
What threshold do the top or bottom X% of cases cross?
Watch out
Software packages use slightly different formulas, so small samples can give different quantiles.
Precise definition

A quantile identifies a value associated with a specified cumulative probability or fraction of ordered observations. The median is the 0.5 quantile, and different interpolation conventions can give slightly different sample quantiles for the same finite dataset.

Often confused with Percentile

Find where the cumulative share reaches 75%
Find where the cumulative share reaches 75%Using the empirical inverse-CDF convention, 7 is the first value whose cumulative share reaches 75% in the sample 1 through 9. 0 2 4 6 8 Ordered value 0.0 0.3 0.6 0.9 Cumulative share
Using the empirical inverse-CDF convention, 7 is the first value whose cumulative share reaches 75% in the sample 1 through 9.

Percentile

The value at or below which a given percentage of cases fall.

Answers
How long do 90% of deliveries take, or where does this customer rank?
Watch out
The 90th percentile is a value, not a percentage, and it is not "90% of the maximum".
Precise definition

A percentile is the value at or below which a stated percentage of observations fall, so the 90th percentile is at least as large as roughly 90% of the data. Percentiles are quantiles expressed on a 0–100 scale; the 50th is the median, and small samples can give slightly different answers under different interpolation rules.

Often confused with Quantile

Nine of ten deliveries took 6 days or less
Nine of ten deliveries took 6 days or lessSorting ten delivery times puts 6 days in ninth place. Ninety percent of deliveries took 6 days or less, so the 90th percentile is 6 days, well above the median of 3.Rank12345678910Days1223334469
Sorting ten delivery times puts 6 days in ninth place. Ninety percent of deliveries took 6 days or less, so the 90th percentile is 6 days, well above the median of 3.

Interquartile Range (IQR)

The width of the middle half of the data, from the 25th to the 75th percentile.

Answers
How spread out are typical values, ignoring extremes?
Watch out
It ignores the tails entirely, so it says nothing about how bad the worst cases are.
Precise definition

The interquartile range is the difference between the 75th and 25th percentiles, describing the spread of the middle half of the data. It is less sensitive to extreme observations than the standard deviation and is often used in exploratory outlier rules.

See also Standard Deviation, Percentile, Outlier

The box spans the middle half
The box spans the middle halfThe box stretches from the 25th percentile at 3 to the 75th at 8. Its width gives an IQR of 5. 1 3 5 8 10 Measured value
The box stretches from the 25th percentile at 3 to the 75th at 8. Its width gives an IQR of 5.

Box Plot

A compact chart of the median, the middle half, the overall range, and any outliers.

Answers
How do several groups compare in level and spread at a glance?
Watch out
It hides the shape inside the box; two very different distributions can draw the same box.
Precise definition

A box plot summarizes a numerical distribution with a box from the first to the third quartile, a line at the median, and whiskers extending to the most extreme values within a set distance, commonly 1.5 times the interquartile range. Points beyond the whiskers are drawn individually as potential outliers, and the plot hides features such as multiple peaks.

Often confused with Histogram · See also Interquartile Range (IQR), Outlier

Anatomy of a box plot
Anatomy of a box plotThe box spans the quartiles 4 and 9, with the median at 6. Whiskers reach the most extreme values within 1.5 × IQR of the box, here 1 and 14, and the point at 19 is drawn separately as a possible outlier. 1 4 6 9 14 19 Days to close a ticket Lowest value within range Q1 25% Median 50% Q3 75% Highest value within range Possible outlier IQR: middle half
The box spans the quartiles 4 and 9, with the median at 6. Whiskers reach the most extreme values within 1.5 × IQR of the box, here 1 and 14, and the point at 19 is drawn separately as a possible outlier.

Skewness

A measure of lopsidedness: whether a distribution has a longer tail on one side.

Answers
Are there a few unusually large (or small) values stretching the data in one direction?
Watch out
With skewed data the mean and median often differ, so "average" figures can mislead; a gap between them is common but not guaranteed.
Precise definition

Skewness describes asymmetry in a distribution, commonly through its standardized third central moment when that moment exists. Positive skew usually indicates a longer or more influential right tail, while zero skew does not by itself establish symmetry or normality.

A long tail to the right
A long tail to the rightMost mass is near the lower values of this gamma distribution. Large positive observations extend the right tail. 0.0 2.5 5.0 7.5 10.0 Value 0.00 0.15 0.30 Density
Most mass is near the lower values of this gamma distribution. Large positive observations extend the right tail.

Kurtosis

A measure of how prone a distribution is to extreme values.

Answers
How often should we expect results far outside the normal range, such as extreme losses or delays?
Watch out
It measures heavy tails, not how peaked or flat the middle looks.
Precise definition

Kurtosis is a standardized fourth-moment measure that is particularly sensitive to extreme deviations and tail behavior, when the fourth moment exists. A normal distribution has kurtosis 3, or excess kurtosis 0, so the convention should always be stated.

See also Normal Distribution

More probability far from the center
More probability far from the centerThe t distribution with five degrees of freedom has heavier tails and excess kurtosis 6. The normal has excess kurtosis 0. The density axis uses a log scale. -6 -3 0 3 6 Value 1 0 − 7 1 0 − 5 1 0 − 3 1 0 − 1 Density (log scale) Normal Student t, df = 5
The t distribution with five degrees of freedom has heavier tails and excess kurtosis 6. The normal has excess kurtosis 0. The density axis uses a log scale.

Q–Q Plot

A chart that checks whether data follow an assumed distribution: if they do, the points lie close to a straight line.

Answers
Is it reasonable to treat this data as normally distributed?
Watch out
A straight pattern off the reference line means the same shape at a different location or scale. Small samples wobble, so look for systematic curves, not single stray points.
Precise definition

A quantile–quantile plot compares quantiles from a dataset with those from a reference distribution or another dataset. Approximate linearity suggests similar distributional shape up to location and scale, while systematic bends or tail departures can reveal mismatches.

See also Quantile

Match quantile to quantile
Match quantile to quantileEach dot pairs an ordered sample value with its theoretical standard-normal quantile. Alignment with the reference line indicates agreement in location, scale, and shape. -2 -1 0 1 2 Theoretical normal quantile -1.5 0.0 1.5 Sample quantile Reference Sample
Each dot pairs an ordered sample value with its theoretical standard-normal quantile. Alignment with the reference line indicates agreement in location, scale, and shape.

Contingency Table

A table that counts how many cases fall into each combination of two categories.

Answers
How do outcomes split across groups, such as defects by production line or churn by plan?
Watch out
Raw counts mislead when groups differ in size; compare row percentages.
Precise definition

A contingency table displays counts for combinations of categories from two or more variables. It is used to describe associations and provides the input for tests such as chi-square independence tests and Fisher's exact test.

See also Fisher's Exact Test

Where the counts sit
Where the counts sitOf 20 plants on line A, 2 were flagged. Read across a row to compare outcomes within a line.LinePassedFlaggedTotalA18220B12820Total301040
Of 20 plants on line A, 2 were flagged. Read across a row to compare outcomes within a line.

Degrees of Freedom

The number of values in a calculation that are still free to vary once the totals or averages already used are fixed.

Answers
Why do formulas divide by n − 1, and why do small samples get wider margins?
Watch out
It is not the sample size, and the formula depends on the method: n − 1 for a sample variance, n − p for a regression with p coefficients, (rows − 1) × (columns − 1) for a contingency table.
Think of it as
Splitting a bill: once everyone but one person has paid, the last share is forced.
Precise definition

Degrees of freedom describe how many independent pieces of information remain after constraints or parameter estimation are accounted for. For example, deviations from a sample mean sum to zero, leaving n − 1 degrees of freedom when estimating variance from n observations.

See also Contingency Table, Sample Size

One constraint fixes the last value
One constraint fixes the last valueDeviations from a sample mean must sum to zero. Once the first two are −3 and +2, the third has to be +1, so only 2 of the 3 are free to vary: n − 1 degrees of freedom.1st value2nd value3rd valueDeviation−3+2+1Free to vary?YesYesNo: forcedRunning sum−3−10
Deviations from a sample mean must sum to zero. Once the first two are −3 and +2, the third has to be +1, so only 2 of the 3 are free to vary: n − 1 degrees of freedom.

Probability, distributions, and information theory

13 terms
Terms in this topic

Random Variable

A quantity whose value depends on chance, such as tomorrow's sales.

Answers
Which number in our plan is uncertain, and what values could it take?
Watch out
"Random" means uncertain, not equally likely or patternless.
Precise definition

A random variable assigns a numerical value to each possible outcome of a random experiment or process. Its distribution describes the probabilities of those values, distinguishing the uncertain quantity from a particular value observed in one realization.

Map outcomes to a number
Map outcomes to a numberLet X count heads in two coin tosses. Different outcomes can map to the same value of X.OutcomeTTTHHTHHX = heads0112
Let X count heads in two coin tosses. Different outcomes can map to the same value of X.

Probability Distribution

A full description of which outcomes are possible and how likely each is.

Answers
What is the whole range of outcomes and their odds, not just the average?
Watch out
For continuous quantities the curve's height is a density, not a probability; probabilities are areas.
Precise definition

A probability distribution specifies how probability is assigned to a random variable's possible values or ranges. Discrete distributions use probability masses, while continuous distributions use densities whose integrals over intervals give probabilities.

See also Random Variable

Assign mass to possible outcomes
Assign mass to possible outcomesThis distribution assigns probabilities 0.25, 0.50, and 0.25 to three outcomes. The bar heights sum to one. Low Medium High 0.00 0.15 0.30 0.45 Probability
This distribution assigns probabilities 0.25, 0.50, and 0.25 to three outcomes. The bar heights sum to one.

Expected Value

The long-run average outcome if the same gamble were repeated many times.

Answers
What is this bet, deal, or lead worth on average?
Watch out
It may be a value that never actually occurs, and it says nothing about the risk around it.
Precise definition

The expected value is a probability-weighted average of a random variable's possible values, computed by a sum or integral when it exists. It represents a long-run average under suitable conditions, and need not be a value that can actually occur in one trial.

See also Random Variable

Weight each possible payout
Weight each possible payoutMultiply each payout by its probability and add the contributions. The expected payout is $3 even though the only possible payouts are $0 and $10.PayoutProbabilityContribution$00.70$0$100.30$3
Multiply each payout by its probability and add the contributions. The expected payout is $3 even though the only possible payouts are $0 and $10.

Joint Probability

The chance that two things both happen.

Answers
What share of customers are both on the premium plan and at risk of churning?
Watch out
Multiplying the two separate probabilities is only valid when the events are independent.
Precise definition

Joint probability is the probability that two or more events occur together, written for two events as P(A ∩ B). It satisfies P(A ∩ B) = P(A | B)P(B), and simplifies to P(A)P(B) only when the events are independent.

Often confused with Conditional Probability

Two conditions in the same cell
Two conditions in the same cellTwo of the 40 inspected plants were both on line A and flagged. Their joint probability in this sample is 2/40 = 5%.LinePassedFlaggedA182B128
Two of the 40 inspected plants were both on line A and flagged. Their joint probability in this sample is 2/40 = 5%.

Conditional Probability

The chance of something given that something else is already known to be true.

Answers
Among customers who opened the email, what share bought?
Watch out
P(A given B) is not P(B given A): "most buyers opened the email" does not mean most openers buy.
Precise definition

Conditional probability is the probability of an event after restricting attention to cases in which another event has occurred. It is written P(A | B), and reversing the conditioning generally changes the answer: P(A | B) need not equal P(B | A).

Often confused with Joint Probability

Restrict the denominator
Restrict the denominatorAmong the 20 plants on line B, 8 are flagged. The conditional probability is 8/20 = 40%, compared with 10/40 = 25% overall.SubsetFlaggedInspectedShareAll lines104025%Line B82040%
Among the 20 plants on line B, 8 are flagged. The conditional probability is 8/20 = 40%, compared with 10/40 = 25% overall.

Bernoulli Distribution

The model for a single yes/no event with a fixed chance of "yes".

Answers
How do we describe one trial: one visitor converting, one item failing?
Watch out
It covers a single trial; the count of successes over a fixed number of independent trials with the same chance follows the binomial.
Precise definition

A Bernoulli distribution describes one trial with two possible outcomes, conventionally coded 1 and 0. Its parameter p is the probability of outcome 1, giving a mean of p and a variance of p(1 − p).

One inspection, two outcomes
One inspection, two outcomesIf the chance of a defect is 0.20, one inspection has probability 0.80 of passing and 0.20 of finding a defect. 0 · Pass 1 · Defect 0.00 0.25 0.50 0.75 Probability
If the chance of a defect is 0.20, one inspection has probability 0.80 of passing and 0.20 of finding a defect.

Binomial Distribution

The model for how many successes you get in a fixed number of independent yes/no trials.

Answers
Out of 200 visitors with a 5% conversion rate, how many sales should we expect, and how far off might that be?
Watch out
It assumes trials are independent with the same chance each time; customers who influence each other break it.
Precise definition

A binomial distribution describes the number of successes in a fixed number n of independent Bernoulli trials with the same success probability p. Its mean is np and its variance is np(1 − p), making it useful for counts such as defective items in a batch under those assumptions.

Count defects in ten inspections
Count defects in ten inspectionsWith ten independent inspections and defect probability 0.20 for each, two defects is the most likely count. 0 1 2 3 4 5 6 7 8 9 10 Number of defects 0.00 0.08 0.16 0.24 Probability
With ten independent inspections and defect probability 0.20 for each, two defects is the most likely count.

Poisson Distribution

The model for how many events occur in a fixed period when they happen independently at a steady rate.

Answers
How many support calls, defects, or arrivals should we plan for per hour?
Watch out
Real counts are often burstier than Poisson predicts, so plans based on it can understate peaks.
Precise definition

A Poisson distribution models a nonnegative event count with mean and variance both equal to a parameter λ. One setting that produces it is an event process with independent increments and a constant rate, while counts with substantially different variance may require another model.

How many events in an hour?
How many events in an hour?At an average rate of three events per hour, the Poisson model gives counts 2 and 3 the same probability. 0 1 2 3 4 5 6 7 8 9 Events in an hour 0.00 0.06 0.12 0.18 Probability
At an average rate of three events per hour, the Poisson model gives counts 2 and 3 the same probability.

Normal Distribution

The symmetric bell curve, fully described by an average and a spread.

Answers
What range of results should we expect when many small independent effects add up?
Watch out
Many business quantities, such as revenue per customer or wait times, are skewed, not bell-shaped.
Precise definition

The normal distribution is a symmetric, bell-shaped continuous distribution determined by its mean and variance. It is a useful model for many errors and sampling distributions, but an observed variable should not be assumed normal simply because it is numerical.

See also Sampling Distribution

Changing spread at a fixed mean
Changing spread at a fixed meanBoth curves are centered at zero. Increasing the standard deviation makes the curve wider and lowers its peak while keeping total area equal to one. -4 -2 0 2 4 Value 0.0 0.2 0.4 Density σ = 0.7 σ = 1.3
Both curves are centered at zero. Increasing the standard deviation makes the curve wider and lowers its peak while keeping total area equal to one.

Bit

The amount of information in one yes/no answer between two equally likely options.

Answers
How much information does a message or prediction actually carry?
Watch out
An information "bit" measures surprise; it is related to, but not the same as, a storage bit on disk.
Think of it as
One well-chosen question in a game of Twenty Questions.
Precise definition

A bit is a unit of information corresponding to a choice between two equally likely possibilities, and a binary digit stores one of two values such as 0 or 1. An event with probability p carries −log₂(p) bits of information, so a fair coin outcome carries 1 bit and an event with probability 1/8 carries 3 bits.

Each halving adds one bit
Each halving adds one bitAn event with probability 1/2 carries one bit of surprise. At probability 1/8 it carries three. 1 1/2 1/4 1/8 Event probability 0 1 2 3 Surprise (bits)
An event with probability 1/2 carries one bit of surprise. At probability 1/8 it carries three.

Entropy

A measure of how unpredictable an outcome is.

Answers
How much uncertainty is there in this outcome, or how mixed is this group?
Watch out
High entropy means hard to predict, not disorder or poor quality.
Think of it as
A floor on the average number of yes/no answers needed to record each outcome, reached only when many outcomes are encoded together.
Precise definition

For a discrete probability distribution, entropy is the expected information or surprise in an outcome: H(p) = −Σ p(x) log p(x). It is zero for a certain outcome and largest for a uniform distribution over a fixed number of possibilities, with units determined by the logarithm base.

Often confused with Cross-entropy · See also Probability Distribution

Which coin is hardest to predict?
Which coin is hardest to predict?A fair coin has one bit of entropy per toss. The entropy approaches zero as either outcome becomes certain. 0.00 0.25 0.50 0.75 1.00 Probability of heads 0.0 0.5 1.0 Entropy (bits)
A fair coin has one bit of entropy per toss. The entropy approaches zero as either outcome becomes certain.

Cross-entropy

A score for probability forecasts that punishes confident wrong answers heavily.

Answers
How good are the model's predicted probabilities, not just its yes/no calls?
Watch out
Lower is better, and the number is only meaningful compared with another model on the same data.
Precise definition

Cross-entropy measures how costly it is, on average, to represent outcomes from a true or target distribution p using probabilities supplied by another distribution q: H(p, q) = −Σ p(x) log q(x). With one observed class per example, classification cross-entropy becomes the negative log probability assigned to the correct class, strongly penalizing confident mistakes. Base-2 logarithms give bits, while natural logarithms give nats.

Often confused with Entropy

Score the probability of the observed class
Score the probability of the observed classAssigning the correct class probability 1/2 costs 1 bit. Assigning it 1/8 costs 3 bits, even though the observed label is unchanged. 0.00 0.25 0.50 0.75 1.00 Probability assigned to observed class 0.0 1.5 3.0 4.5 Loss (bits)
Assigning the correct class probability 1/2 costs 1 bit. Assigning it 1/8 costs 3 bits, even though the observed label is unchanged.

Kullback–Leibler (KL) Divergence

A measure of how much one probability distribution differs from another.

Answers
How far have this month's patterns moved from the baseline, or how far is the model from reality?
Watch out
It is not symmetric: the divergence from A to B differs from that from B to A.
Precise definition

KL divergence measures a directional discrepancy between probability distributions: D_KL(p || q) = Σ p(x) log[p(x) / q(x)] for discrete outcomes. It is nonnegative but generally asymmetric, so it is not a distance metric; for discrete distributions with finite quantities, cross-entropy equals entropy plus KL divergence.

See also Probability Distribution, Cross-entropy, Entropy

The cost of using the wrong coin model
The cost of using the wrong coin modelThe reference coin has heads probability 0.70. The extra expected coding cost vanishes when the model also assigns 0.70. 0.00 0.25 0.50 0.75 1.00 Model probability of heads 0.0 1.5 3.0 4.5 KL divergence (bits)
The reference coin has heads probability 0.70. The extra expected coding cost vanishes when the model also assigns 0.70.

Sampling, estimation, and Bayesian inference

21 terms
Terms in this topic

Probability Sampling

Choosing who to measure by a random method in which every member has a known chance of selection.

Answers
How do we pick a sample we can legitimately generalize from?
Watch out
"Random" does not mean haphazard or convenient; it requires an actual random mechanism.
Precise definition

Probability sampling selects units using a random mechanism with known, nonzero inclusion probabilities for the target population units. Designs include simple random, stratified, and cluster sampling, and appropriate analysis accounts for the selection design and any required weights.

Give each bed a known chance
Give each bed a known chanceRandomly selecting 2 of 10 beds in each zone gives each bed a 20% inclusion probability. The three selections are made separately.StratumBedsRandom drawChanceNorth10220%East10220%West10220%
Randomly selecting 2 of 10 beds in each zone gives each bed a 20% inclusion probability. The three selections are made separately.

Sampling Bias

A systematic error caused by how cases got into the sample, when the analysis does not correct for it.

Answers
Who is missing from our data, and would they have answered differently?
Watch out
A larger biased sample just gives a more precise wrong answer. Deliberate oversampling of a subgroup is not bias if the analysis reweights for it.
Think of it as
Judging customer satisfaction only from the people who chose to answer the survey.
Precise definition

Sampling bias occurs when the selection or participation process systematically makes the observed sample unrepresentative for the question being studied. Increasing the size of a biased sample can make an incorrect estimate more precise without fixing the bias.

Often confused with Bias · See also Oversampling

What weekday-only sampling misses
What weekday-only sampling missesA weekday-only survey never observes the 20 weekend shifts. More weekday observations cannot recover weekend conditions by themselves.Shift typeIn populationIn sampleWeekday5025Weekend200
A weekday-only survey never observes the 20 weekend shifts. More weekday observations cannot recover weekend conditions by themselves.

Inference

Drawing conclusions about the wider world from a sample; in machine learning, running a trained model on new inputs.

Answers
What can we conclude beyond the data in hand? Or: what does the model predict for this case?
Watch out
The two meanings are unrelated; "inference cost" in AI refers to running models, not to statistics.
Precise definition

In statistics, inference means using observed data and assumptions to learn about unknown population quantities or processes. In deployed machine learning, inference often means running a trained model on new inputs to produce outputs, so the intended meaning depends on context.

Two tasks called inference
Two tasks called inferenceA sample of plant weights can estimate a population mean. A trained model can use light and temperature to predict a new plant’s weight.ContextInputOutputStatisticalSample weightsEstimate of meanML deploymentNew measurementsPredicted weight
A sample of plant weights can estimate a population mean. A trained model can use light and temperature to predict a new plant’s weight.

Sampling Distribution

The spread of values a statistic would take across many repeated samples.

Answers
How much would this number change if we ran the study again?
Watch out
It is about the statistic, such as an average, not about the spread of the raw data.
Precise definition

A sampling distribution is the probability distribution of a statistic across repeated samples generated by a specified sampling process. It describes how estimates such as means or regression coefficients would vary, rather than how individual observations vary within one sample.

See also Probability Distribution

Try the averaging slider ↗

One statistic across many possible samples
One statistic across many possible samplesFor independent normal measurements with mean 10 and standard deviation 4, the mean of 16 observations follows a normal distribution with standard deviation 1. 7.5 9.0 10.5 12.0 Sample mean 0.00 0.15 0.30 Density
For independent normal measurements with mean 10 and standard deviation 4, the mean of 16 observations follows a normal distribution with standard deviation 1.

Standard Error

The typical amount an estimate would move from one sample to the next.

Answers
How precisely do we know this average or rate?
Watch out
It shrinks as the sample grows; the standard deviation does not. The two are often confused.
Think of it as
The wobble of the average, as opposed to the spread of the individuals.
Precise definition

A standard error is the standard deviation of an estimator's sampling distribution, usually estimated from observed data. For an independent, identically distributed sample, the sample mean's estimated standard error is s / √n, while dependence or a complex sampling design can require a different calculation.

Often confused with Standard Deviation · See also Sampling Distribution

How precisely is the mean estimated?
How precisely is the mean estimated?With independent measurements and population standard deviation 10 g, increasing the sample from 25 to 100 halves the standard error from 2 g to 1 g. 0 25 50 75 100 Sample size 2.5 5.0 7.5 10.0 Standard error (g)
With independent measurements and population standard deviation 10 g, increasing the sample from 25 to 100 halves the standard error from 2 g to 1 g.

Law of Large Numbers

As you average more and more observations, the average settles toward the true value.

Answers
Why do results stabilize as data accumulates, and why are early results jumpy?
Watch out
It describes the long run: a single new observation can move the average away from the truth, and a run of bad luck is not "due" to be balanced out.
Precise definition

The law of large numbers states that a sample average approaches the population expected value as the sample grows under suitable conditions. It explains the stabilization of averages, while the central limit theorem describes the approximate shape and scale of their remaining fluctuations.

See also Central Limit Theorem, Expected Value

Try the random-points simulation ↗

Watch a running proportion settle
Watch a running proportion settleIn this simulated sequence of coin tosses, the running fraction of heads fluctuates around the true heads probability of 0.60 and becomes steadier as more tosses accumulate. 0 150 300 450 600 Number of tosses 0.0 0.3 0.6 0.9 Fraction of heads
In this simulated sequence of coin tosses, the running fraction of heads fluctuates around the true heads probability of 0.60 and becomes steadier as more tosses accumulate.

Central Limit Theorem

Averages of many independent values from the same distribution, provided its spread is finite, come close to a bell curve even when the individual values do not.

Answers
Why can we use normal-based margins of error on averages of skewed data?
Watch out
It applies to averages, not to the raw data; very skewed data need larger samples, and it fails for distributions with tails so heavy that the variance is infinite.
Think of it as
Individual orders are erratic; daily averages are tame.
Precise definition

The central limit theorem explains why a suitably standardized sample mean approaches a normal distribution under conditions such as independent, identically distributed observations with finite variance. It concerns the distribution of means across repeated samples, not whether the original observations themselves become normally distributed.

See also Normal Distribution

Means become more nearly normal
Means become more nearly normalThese curves show standardized means of independent exponential observations. As the sample size grows, the distribution of the mean approaches the dashed normal reference. -2 0 2 4 Standardized sample mean 0.00 0.15 0.30 0.45 Density n = 2 Normal n = 25
These curves show standardized means of independent exponential observations. As the sample size grows, the distribution of the mean approaches the dashed normal reference.

Confidence Interval

A range of plausible values for the true figure, built by a method that captures it a stated share of the time.

Answers
How precise is this estimate: what is the plausible range for the true value?
Watch out
95% describes the method's long-run hit rate, not a 95% chance that the truth is in this particular interval.
Think of it as
Ring toss at a fixed stake: 95% of throws land around it.
Precise definition

A confidence interval is produced by a procedure designed to contain a fixed population parameter at a stated rate over repeated samples, under the model's assumptions. For example, a 95% procedure covers the parameter in 95% of repetitions; this is not a 95% probability statement about the fixed parameter lying in one already calculated interval.

Often confused with Credible Interval, Prediction Interval, Margin of Error

What repeated coverage means
What repeated coverage meansEach line is one 95% interval from a fresh sample of the same population, whose true mean is zero. In this run 1 of the 20 intervals misses (orange), which matches the long-run rate of about 1 in 20. −1.2 −0.6 0.0 0.6 1.2 Estimated mean and interval
Each line is one 95% interval from a fresh sample of the same population, whose true mean is zero. In this run 1 of the 20 intervals misses (orange), which matches the long-run rate of about 1 in 20.

Margin of Error

The "plus or minus" attached to a survey result.

Answers
How far could the true figure be from the survey number through sampling chance alone?
Watch out
It covers random sampling error only, not biased samples or bad questions, and it is larger for subgroups.
Precise definition

The margin of error is the half-width of a confidence interval, usually quoted for a survey percentage at 95% confidence. For a simple random sample it is approximately 1.96 × √(p(1 − p)/n), so it shrinks with the square root of the sample size, and it reflects sampling variability only, not biased selection or poorly worded questions.

Often confused with Confidence Interval · See also Sample Size

Try the sample-size calculator ↗

Precision improves with the square root of n
Precision improves with the square root of nFor a 50% result at 95% confidence, 100 responses give about ±9.8 percentage points, 400 give ±4.9, and 1,600 give ±2.4. Each halving of the margin costs four times the sample. 100 400 800 1200 1600 2000 Survey responses 0.0 2.5 5.0 7.5 10.0 12.5 15.0 Margin of error (points) ±9.8 ±4.9 ±2.4
For a 50% result at 95% confidence, 100 responses give about ±9.8 percentage points, 400 give ±4.9, and 1,600 give ±2.4. Each halving of the margin costs four times the sample.

Sample Size

How many observations a study has, or needs.

Answers
How much data do we need before we can trust the answer?
Watch out
Detecting an effect half the size takes about four times the sample, not twice.
Precise definition

Sample size is the number of observations in a study, and sample-size planning chooses it in advance so that estimates are precise enough or a test has adequate power. The required number rises steeply as the effect to be detected gets smaller: halving the detectable difference roughly quadruples the sample needed.

Often confused with Statistical Power

Smaller effects need far more data
Smaller effects need far more dataFor a two-sided test at α = 0.05 with 80% power and a 10% baseline conversion rate, detecting a 2-point lift needs about 3,800 visitors per group. Halving the lift to 1 point needs about 14,700.Lift to detectConversionVisitors per group5 points10% → 15%6832 points10% → 12%3,8391 point10% → 11%14,749
For a two-sided test at α = 0.05 with 80% power and a 10% baseline conversion rate, detecting a 2-point lift needs about 3,800 visitors per group. Halving the lift to 1 point needs about 14,700.

Prediction Interval

A range expected to contain a single future observation.

Answers
What range should we plan for next month's actual figure?
Watch out
It is wider than a confidence interval, which covers only the average and not an individual outcome.
Precise definition

A prediction interval gives a range intended to contain a future observation with a specified coverage rate under the model. It includes both uncertainty about the estimated mean and the variability of individual outcomes, so it is generally wider than the corresponding confidence interval for the mean.

Often confused with Confidence Interval

Forecast one observation or estimate a mean
Forecast one observation or estimate a meanThe outer band includes individual outcome variation as well as uncertainty in the estimated line. Both illustrative bands widen away from the center of the data. 2 4 6 8 Predictor 8 16 24 Response New observation Mean response
The outer band includes individual outcome variation as well as uncertainty in the estimated line. Both illustrative bands widen away from the center of the data.

Bootstrapping

Estimating uncertainty by repeatedly resampling your own data and recalculating the statistic.

Answers
How much would this metric move if we had drawn a different sample?
Watch out
It cannot fix an unrepresentative sample; it only reuses what you have.
Precise definition

Bootstrapping estimates the variability of a statistic by repeatedly resampling observed data with replacement and recalculating the statistic. Ordinary bootstrapping treats observations as independent, while time series and grouped data may require block or cluster resampling to preserve dependence.

Often confused with Permutation Test

Draw with replacement
Draw with replacementEach bootstrap sample has four observations. An original value can appear multiple times or be absent from a resample.Original2468Resample 14482Resample 26866
Each bootstrap sample has four observations. An original value can appear multiple times or be absent from a resample.

Bias

A systematic error that pushes results in one direction, as opposed to random scatter.

Answers
Is our estimate or model consistently off, and in which direction?
Watch out
More data does not fix a biased measurement or selection process, although some estimator biases do shrink as samples grow. In neural networks "bias" is just an offset term, unrelated to unfairness.
Think of it as
A bathroom scale that always reads two kilos heavy.
Precise definition

In estimation, bias is the difference between an estimator's average value over repeated samples and the true quantity being estimated. In machine learning, the word also describes systematic modeling error or unfair patterns, while a neural network's bias parameter is simply an additive offset; these meanings should be distinguished.

Often confused with Sampling Bias

The estimator misses in one direction
The estimator misses in one directionThe repeated-sample estimates center at 52 while the target is 50. Bias is the difference between those centers, +2. 44 48 52 56 Estimated value 0.00 0.08 0.16 0.24 Density
The repeated-sample estimates center at 52 while the target is 50. Bias is the difference between those centers, +2.

Likelihood

How well a particular assumption explains the data actually observed.

Answers
Which explanation fits what we saw best?
Watch out
It is not the probability that the assumption is true.
Precise definition

Likelihood treats the observed data as fixed and evaluates how well different parameter values account for those data through a probability mass function or density. It is a function of parameters and is not, by itself, a probability distribution over those parameters.

Often confused with P-value · See also Probability Distribution

Hold seven heads in ten tosses fixed
Hold seven heads in ten tosses fixedEach candidate coin bias gives a likelihood for the same observed count. The height compares how well each bias accounts for those data. 0.00 0.25 0.50 0.75 1.00 Candidate heads probability 0.00 0.08 0.16 0.24 P(7 heads in 10)
Each candidate coin bias gives a likelihood for the same observed count. The height compares how well each bias accounts for those data.

Maximum Likelihood Estimation (MLE)

Choosing the parameter values that best account for the observed data: those giving the data the highest probability, or probability density for continuous measurements.

Answers
What settings of the model best fit our data?
Watch out
The best-fitting values can still be poor if the model is wrong or the data are few.
Precise definition

Maximum likelihood estimation chooses parameter values that maximize the likelihood of the observed data under an assumed model. For independent normal errors with common variance, estimating linear regression coefficients by MLE gives the same coefficients as minimizing squared residuals.

See also Likelihood, Linear Regression

Locate the highest point
Locate the highest pointFor seven heads in ten tosses, the binomial likelihood reaches its maximum at p = 0.70. The dot marks the parameter estimate. 0.00 0.25 0.50 0.75 1.00 Candidate heads probability 0.00 0.08 0.16 0.24 Likelihood
For seven heads in ten tosses, the binomial likelihood reaches its maximum at p = 0.70. The dot marks the parameter estimate.

Bayes' Theorem

The rule for updating a probability when new evidence arrives.

Answers
Given a positive test or alert, how likely is the thing it flags?
Watch out
The answer depends heavily on how common the condition was to begin with.
Think of it as
Start with the odds, then adjust them by how much more likely the evidence is if the claim is true.
Precise definition

Bayes' theorem relates a conditional probability to its reverse: P(A | B) = P(B | A)P(A) / P(B), provided P(B) is positive. In inference, it explains how prior beliefs and the likelihood of observed evidence combine to produce posterior beliefs.

Often confused with Base-Rate Fallacy · See also Likelihood, Conditional Probability

Try the base-rate sliders ↗

How often is an alert a real fault?
How often is an alert a real fault?Of 18 alerts, 9 come from faulty items. This gives P(fault | alert) = 9/18 = 50%, starting from a fault rate of 10/100.ConditionAlertsNo alertTotalFault9110Healthy98190Total1882100
Of 18 alerts, 9 come from faulty items. This gives P(fault | alert) = 9/18 = 50%, starting from a fault rate of 10/100.

Base-Rate Fallacy

Forgetting how rare something is when interpreting a test or alert that flags it.

Answers
If the alert fires, how likely is it to be the real thing?
Watch out
A "95% accurate" detector can still be wrong most of the times it fires, when what it detects is rare.
Think of it as
A smoke alarm that goes off whenever you make toast: most alarms are not fires, because fires are rare.
Precise definition

The base-rate fallacy is the error of judging how likely something is from case-specific evidence while neglecting how common it is to begin with. When a condition is rare, a test or alert can produce mostly false positives even with a seemingly small false-positive rate, because that rate applies to a very large number of unaffected cases. How many depends on the rate itself: at 1% prevalence and 90% sensitivity, a 5% false-positive rate leaves about 15% of alerts real, while a 0.01% rate leaves about 99%.

Often confused with Bayes' Theorem

Most alerts are false when fraud is rare
Most alerts are false when fraud is rareThe alert catches 90% of fraud and wrongly flags 5% of legitimate transactions. Because fraud is only 1% of traffic, just 90 of the 585 alerts are real: about 15%.Per 10,000AlertNo alertTotalFraud (1%)9010100Legitimate4959,4059,900Total5859,41510,000
The alert catches 90% of fraud and wrongly flags 5% of legitimate transactions. Because fraud is only 1% of traffic, just 90 of the 585 alerts are real: about 15%.

Bayesian Inference

An approach that starts from a prior belief and updates it with data to give a probability for each possible answer.

Answers
Given what we knew and what we just observed, how likely is each scenario?
Watch out
Results depend on the starting assumption, especially when data are scarce.
Precise definition

Bayesian inference represents uncertainty about unknown quantities using probability distributions and updates those distributions after observing data. Its results depend on the prior, the likelihood model, and the evidence, and can be summarized through posterior estimates, credible intervals, and predictive distributions.

See also Credible Interval, Likelihood, Probability Distribution

Learning the probability of heads
Learning the probability of headsA uniform Beta(1,1) prior updates to Beta(4,2) after three heads and one tail. Six more heads and two more tails give Beta(10,4). 0.00 0.25 0.50 0.75 1.00 Probability of heads 0 1 2 3 Density Prior 4 tosses 12 tosses
A uniform Beta(1,1) prior updates to Beta(4,2) after three heads and one tail. Six more heads and two more tails give Beta(10,4).

Prior Distribution

The belief about an unknown before looking at the new data.

Answers
What did we reasonably expect before this test?
Watch out
A strong prior can dominate small datasets, so it should be stated and justified.
Precise definition

A prior distribution represents uncertainty about a quantity before the data used in a particular analysis are incorporated. It can encode previous evidence or regularizing assumptions, and its influence on the posterior depends on its strength relative to the information in the likelihood.

See also Likelihood

Two starting assumptions
Two starting assumptionsBeta(1,1) puts equal density across all success probabilities. Beta(5,5) concentrates more heavily near one half before any new data arrive. 0.00 0.25 0.50 0.75 1.00 Success probability 0.0 0.8 1.6 2.4 Prior density Beta(1,1) Beta(5,5)
Beta(1,1) puts equal density across all success probabilities. Beta(5,5) concentrates more heavily near one half before any new data arrive.

Posterior Distribution

The updated belief about an unknown after combining the prior with the data.

Answers
After seeing the results, what do we now believe and how sure are we?
Watch out
With little data, the posterior mostly echoes the prior.
Precise definition

A posterior distribution describes uncertainty about parameters or other unknown quantities after incorporating observed data through Bayes' theorem. It is proportional to the prior times the likelihood and supports Bayesian estimation, credible intervals, and prediction.

See also Credible Interval, Bayes' Theorem, Likelihood

Uncertainty after the observations
Uncertainty after the observationsA Beta(1,1) prior and six successes in nine trials give this Beta(7,4) posterior. Its mean is 7/11, about 0.64. 0.00 0.25 0.50 0.75 1.00 Success probability 0.0 0.8 1.6 2.4 Posterior density
A Beta(1,1) prior and six successes in nine trials give this Beta(7,4) posterior. Its mean is 7/11, about 0.64.

Credible Interval

A Bayesian range that contains the true value with a stated probability, given the data and the prior.

Answers
What range are we 95% sure the true value lies in?
Watch out
It depends on the prior; do not treat it as interchangeable with a confidence interval.
Precise definition

A Bayesian credible interval contains a specified proportion of a parameter's posterior probability, conditional on the data and the assumed model. A 95% credible interval therefore supports a posterior probability statement about that parameter, unlike the repeated-sampling interpretation of a frequentist confidence interval.

Often confused with Confidence Interval

Keep the middle 95% of posterior mass
Keep the middle 95% of posterior massFor a Beta(7,4) posterior, the shaded equal-tailed interval runs from approximately 0.35 to 0.88. 0.00 0.25 0.50 0.75 1.00 Success probability 0.0 0.8 1.6 2.4 Posterior density
For a Beta(7,4) posterior, the shaded equal-tailed interval runs from approximately 0.35 to 0.88.

Hypothesis testing and statistical tests

33 terms
Terms in this topic

Hypothesis Testing

A formal procedure for deciding whether data are consistent with a stated reference claim, the null hypothesis, which is usually "no effect".

Answers
Could this difference plausibly be just chance?
Watch out
It never proves a hypothesis; it only says how surprising the data would be if the null hypothesis and the test's assumptions were true.
Think of it as
A court trial: the null hypothesis is presumed innocent until the evidence is strong enough.
Precise definition

Hypothesis testing assesses how compatible observed data are with a specified null hypothesis using a test statistic and a decision rule. Rejecting or failing to reject the null is conditional on the assumptions and design; neither outcome proves a hypothesis true.

See also Null Hypothesis

From a claim to a decision
From a claim to a decisionFor a prespecified two-sided z-test, an observed z of 2.10 yields p ≈ 0.036. At α = 0.05 the decision is to reject the null.H₀Mean = 0z = 2.10p ≈ 0.036At α = 0.05Reject H₀
For a prespecified two-sided z-test, an observed z of 2.10 yields p ≈ 0.036. At α = 0.05 the decision is to reject the null.

Null Hypothesis

The specific reference claim a test is run against: most often "no effect" or "no difference", but it can be any stated value, such as "mean fill weight is 500 g".

Answers
What would we expect to see if the change did nothing?
Watch out
Failing to reject it is not proof that there is no effect; the study may simply be too small.
Precise definition

The null hypothesis, written H₀, is the reference claim used to derive a statistical test's behavior, often specifying no difference or no association. Failing to reject it means the test did not provide sufficient evidence against it, not that the claim has been established as true.

Often confused with Alternative Hypothesis

The reference distribution
The reference distributionIf the null mean difference is zero and the z-test assumptions hold, the standardized estimated difference follows this curve centered at zero. -4 -2 0 2 4 z under the null 0.00 0.15 0.30 Density
If the null mean difference is zero and the z-test assumptions hold, the standardized estimated difference follows this curve centered at zero.

Alternative Hypothesis

The claim you are looking for evidence of, such as "the new version performs differently".

Answers
What effect are we hoping to detect?
Watch out
Rejecting the null supports the alternative but does not say how large or important the effect is.
Precise definition

The alternative hypothesis, often written H₁ or Hₐ, describes the effect or difference being considered in opposition to the null hypothesis. It may specify a direction, such as a higher mean yield, or allow a difference in either direction.

Often confused with Null Hypothesis

What a positive shift predicts
What a positive shift predictsUnder the example alternative, the test statistic has mean 2. Under the null, it has mean 0. The overlap explains why the data cannot perfectly distinguish them. -2.5 0.0 2.5 5.0 Standardized test statistic 0.00 0.15 0.30 Density Null Alternative
Under the example alternative, the test statistic has mean 2. Under the null, it has mean 0. The overlap explains why the data cannot perfectly distinguish them.

P-value

How often a result at least this extreme would occur if the null hypothesis and the test's assumptions were true.

Answers
How surprising is this result if the change made no difference?
Watch out
It is not the probability that the result is due to chance, nor that the null hypothesis is true.
Think of it as
How surprised a skeptic would be.
Precise definition

A p-value is the probability, under the null hypothesis and the test's assumptions, of obtaining a test statistic at least as extreme as the observed one. It is not the probability that the null hypothesis is true, the probability that a result happened by chance, or a measure of effect size.

Often confused with Significance Level, Likelihood · See also Null Hypothesis, Effect Size

Try the A/B test calculator ↗

Tail area beyond the observed result
Tail area beyond the observed resultFor an upper-tailed z-test with observed z = 2.00, the shaded area is about 0.0228 under the null. -4 -2 0 2 4 Test statistic (z) 0.00 0.15 0.30 Density
For an upper-tailed z-test with observed z = 2.00, the shaded area is about 0.0228 under the null.

Significance Level

The false-alarm rate you accept in advance, commonly 5%.

Answers
How strong must the evidence be before we act on it?
Watch out
5% is a convention, not a law; the right threshold depends on the cost of being wrong.
Precise definition

The significance level α is a prespecified threshold governing a test's probability of rejecting a true null hypothesis under its assumptions. A value such as 0.05 refers to the procedure's Type I error control, not to the probability that a particular rejected hypothesis was actually true.

Often confused with P-value, Statistical Power · See also Null Hypothesis, Type I Error

Set the false-alarm threshold
Set the false-alarm thresholdThe shaded right tail contains 1% of the null distribution. Choosing α = 0.01 sets the critical z value near 2.326 for this one-sided test. -4 -2 0 2 4 Test statistic (z) 0.00 0.15 0.30 Density
The shaded right tail contains 1% of the null distribution. Choosing α = 0.01 sets the critical z value near 2.326 for this one-sided test.

Statistical Significance

A result that would be unlikely if the null hypothesis were true, judged against a pre-set standard.

Answers
Is this difference more than noise?
Watch out
Significant does not mean large or important; with enough data, trivial differences become significant.
Precise definition

A result is statistically significant when it meets a prespecified rejection rule, commonly a p-value at or below α for the chosen test. Significance does not by itself indicate a large effect, practical importance, a causal relationship, or a high probability that the alternative hypothesis is true.

Often confused with Effect Size · See also Alternative Hypothesis, Null Hypothesis, P-value

Try the A/B test calculator ↗

Decide at a prespecified threshold
Decide at a prespecified thresholdWith α = 0.05, the first study meets the test’s significance rule and the second does not. The p-values alone give no effect sizes.Studyp-valueAt α = 0.05A0.032Reject H₀B0.082Fail to reject
With α = 0.05, the first study meets the test’s significance rule and the second does not. The p-values alone give no effect sizes.

Type I Error

A false alarm: rejecting a null hypothesis that is actually true, typically concluding there is an effect when there is none.

Answers
What is the risk of rolling out a change that actually does nothing?
Watch out
Its rate is capped by the significance level you choose (at most α when the test's assumptions hold); it is not determined by the data.
Think of it as
The fire alarm goes off, but there is no fire.
Precise definition

A Type I error occurs when a statistical test rejects a null hypothesis that is actually true. Its probability is controlled by the significance level under the test's assumptions, with additional care needed when many hypotheses are tested.

Often confused with Type II Error · See also Significance Level, Null Hypothesis

Rejecting a true null
Rejecting a true nullThe shaded area under the solid null curve to the right of 1.645 is about 5%. It is the false-rejection probability for this one-sided rule. -2.5 0.0 2.5 5.0 Standardized test statistic 0.00 0.15 0.30 Density Null Alternative
The shaded area under the solid null curve to the right of 1.645 is about 5%. It is the false-rejection probability for this one-sided rule.

Type II Error

A miss: failing to detect an effect that is really there.

Answers
What is the risk of abandoning a change that actually works?
Watch out
It is most common in small studies and is often ignored because nothing visibly goes wrong.
Think of it as
Sleeping through a real fire.
Precise definition

A Type II error occurs when a test fails to reject a false null hypothesis for a particular alternative. Its probability is denoted β, and statistical power is 1 − β for that specified alternative.

Often confused with Type I Error · See also Statistical Power, Null Hypothesis

Missing a specified effect
Missing a specified effectUnder the dashed alternative with mean 2, about 36% of the distribution falls below the cutoff 1.645. This shaded area is β for this alternative. -2.5 0.0 2.5 5.0 Standardized test statistic 0.00 0.15 0.30 Density Null Alternative
Under the dashed alternative with mean 2, about 36% of the distribution falls below the cutoff 1.645. This shaded area is β for this alternative.

Statistical Power

The chance that a study detects an effect of a given size, if it really exists.

Answers
Is this test big enough to find the improvement we care about?
Watch out
A low-powered test that finds nothing has not shown there is nothing to find.
Think of it as
The sensitivity of a metal detector: a weak one walks over coins without beeping.
Precise definition

Statistical power is the probability that a test rejects the null hypothesis under a specified alternative, equal to 1 − β. It depends on the effect size, sample size, variability, significance level, and study design rather than being a fixed property of a test alone.

Often confused with Sample Size, Significance Level · See also Null Hypothesis, Effect Size

Try the sample-size calculator ↗

Power is area under the alternative
Power is area under the alternativeFor the specified mean shift of 2 and a one-sided cutoff of 1.645, about 64% of the alternative distribution falls in the rejection region. -2.5 0.0 2.5 5.0 Standardized test statistic 0.00 0.15 0.30 Density Null Alternative
For the specified mean shift of 2 and a one-sided cutoff of 1.645, about 64% of the alternative distribution falls in the rejection region.

Effect Size

How big a difference or relationship is, in meaningful units.

Answers
Is the difference large enough to matter commercially?
Watch out
A tiny effect can be "statistically significant" with enough data; size and significance are separate questions.
Precise definition

An effect size quantifies the magnitude of a difference or relationship, such as a mean difference, odds ratio, or standardized difference. It addresses how large an effect is, whereas a p-value addresses compatibility with a specified null model and is also affected by sample size.

Often confused with Statistical Significance · See also P-value, Sample Size

Express the change in harvest units
Express the change in harvest unitsThe mean difference is 162 − 150 = 12 grams per plant. That difference gives an effect size in the original measurement units. Control Treatment 0 50 100 150 Mean weight (g)
The mean difference is 162 − 150 = 12 grams per plant. That difference gives an effect size in the original measurement units.

One-Tailed Test

A test that looks for a difference in one pre-chosen direction only.

Answers
Is the new version better (never mind whether it is worse)?
Watch out
The direction must be chosen before seeing the data; picking the favorable side afterwards inflates the false-alarm rate, doubling it in the standard case.
Precise definition

A one-tailed test evaluates evidence against a null hypothesis in one prespecified direction, such as whether average yield increased. The direction should be chosen before examining the result, because selecting it afterward changes the test's error properties.

Often confused with Two-Tailed Test · See also Null Hypothesis

Allocate the rejection region to one side
Allocate the rejection region to one sideFor an upper-tailed z-test at α = 0.05, the shaded rejection region begins at about 1.645. -4 -2 0 2 4 Test statistic (z) 0.00 0.15 0.30 Density
For an upper-tailed z-test at α = 0.05, the shaded rejection region begins at about 1.645.

Two-Tailed Test

A test that looks for a difference in either direction.

Answers
Is the new version different, whether better or worse?
Watch out
It is the safer default; a one-tailed test should not be chosen just to get under the threshold.
Precise definition

A two-tailed test evaluates departures from the null hypothesis in either direction, such as an increase or decrease in mean yield. For a conventional symmetric test, the rejection probability is allocated across both tails of the null distribution.

Often confused with One-Tailed Test · See also Null Hypothesis

Split the rejection area
Split the rejection areaAt α = 0.05, the standard normal test puts 2.5% in each shaded tail. The cutoffs are about −1.96 and +1.96. -4 -2 0 2 4 Test statistic (z) 0.00 0.15 0.30 Density
At α = 0.05, the standard normal test puts 2.5% in each shaded tail. The cutoffs are about −1.96 and +1.96.

A/B Testing

A controlled experiment that randomly splits people between two versions to see which performs better.

Answers
Does the new page, price, or email actually cause better results?
Watch out
Repeatedly checking an ordinary test and stopping at the first significant result inflates false wins. Fix the sample size in advance, or use a sequential design built for early stopping.
Think of it as
A taste test where a coin flip decides who gets which recipe.
Precise definition

An A/B test is a randomized experiment that assigns units such as visitors at random to two versions and compares an outcome such as conversion rate between them. Random assignment makes the groups comparable, so a difference larger than chance would plausibly produce can be attributed to the change, provided the stopping rule was fixed in advance: either a single analysis at a planned sample size, or a sequential design constructed to allow early stopping.

See also Sample Size

Did the new checkout page convert better?
Did the new checkout page convert better?B converts 0.7 percentage points better, a 14% relative lift. A two-proportion z-test gives z ≈ 2.20 and p ≈ 0.028, with a 95% (Newcombe) interval for the lift of roughly 0.1 to 1.3 points.VersionVisitorsOrdersConversionA (current)10,0005005.0%B (new)10,0005705.7%
B converts 0.7 percentage points better, a 14% relative lift. A two-proportion z-test gives z ≈ 2.20 and p ≈ 0.028, with a 95% (Newcombe) interval for the lift of roughly 0.1 to 1.3 points.

Z-test

A test of an average or proportion against a benchmark, based on the normal distribution.

Answers
Is this conversion rate different from the target, or from another group's?
Watch out
It relies on large samples or a known spread; with small samples a t-test is usually appropriate.
Precise definition

A z-test evaluates a hypothesis using a statistic that follows a standard normal distribution exactly or approximately under the null. Examples include testing a mean with known population variance under appropriate assumptions and large-sample tests of proportions, while estimated-variance mean tests commonly use a t distribution.

Often confused with T-test · See also Normal Distribution

Compare a mean with a reference
Compare a mean with a referenceFor known population SD 10 and n = 25, the mean has standard error 2. An observed mean of 54 against H₀: μ = 50 gives z = 2.54 − 50Difference = 410 ÷ √25SE = 24 ÷ 2z = 2
For known population SD 10 and n = 25, the mean has standard error 2. An observed mean of 54 against H₀: μ = 50 gives z = 2.

T-test

A test of whether an average differs from a benchmark, or two averages from each other.

Answers
Is average order value different between two groups?
Watch out
It compares means and assumes independent observations. Skew alone does not rule it out; a small sample with extreme values does.
Precise definition

A t-test evaluates a hypothesis about a mean or difference in means using a statistic with a t distribution under suitable assumptions. Common forms include one-sample, independent-sample, and paired tests, with different assumptions about dependence, variance, and normality.

Often confused with Z-test, Mann–Whitney U Test

Allow for an estimated standard error
Allow for an estimated standard errorWith five independent normal observations, a one-sample t statistic has four degrees of freedom under the null. Its heavier tails reflect greater uncertainty. -4 -2 0 2 4 Test statistic 0.00 0.15 0.30 Density t, df = 4 Normal
With five independent normal observations, a one-sample t statistic has four degrees of freedom under the null. Its heavier tails reflect greater uncertainty.

Welch's t-test

A two-group comparison of averages that does not assume the groups are equally variable.

Answers
Do two groups differ on average when one is much more spread out or much larger than the other?
Watch out
It is the safer default for two groups; the classic equal-variance t-test can mislead when spreads differ.
Precise definition

Welch's t-test compares two independent population means without assuming equal population variances. It adjusts the standard error and degrees of freedom for unequal variances and sample sizes, while still relying on suitable independence and distributional or large-sample conditions.

Often confused with Paired t-test · See also T-test, Degrees of Freedom, Standard Error, Sample Size

Allow each group its own variance
Allow each group its own varianceThe standard error of the difference is √(2²/10 + 6²/15) ≈ 1.67. Welch’s test uses separate variance estimates for the two independent groups.GroupSample meanSample SDSample nA14210B18615
The standard error of the difference is √(2²/10 + 6²/15) ≈ 1.67. Welch’s test uses separate variance estimates for the two independent groups.

Paired t-test

A test of the average change when the same units are measured twice.

Answers
Did the same stores or customers improve after the change?
Watch out
It needs genuine pairs, and any normality check applies to the within-pair differences, not to the before and after values separately.
Precise definition

A paired t-test evaluates whether the population mean difference between matched measurements equals a specified value, usually zero. It analyzes within-pair differences, requiring independent pairs and, for exact small-sample inference, normally distributed differences rather than normality of each measurement series separately.

Often confused with Welch's t-test · See also T-test

Connect each unit to itself
Connect each unit to itselfEach line follows the same bed across two measurements. The t-test uses the five within-bed differences, whose mean is 1.0 in this example. Before After 6.0 7.5 9.0 Yield (kg)
Each line follows the same bed across two measurements. The t-test uses the five within-bed differences, whose mean is 1.0 in this example.

Analysis of Variance (ANOVA)

A test of whether several group averages differ by more than chance would explain. It is usually used for three or more groups; with two it matches the equal-variance t-test.

Answers
Do average results differ across several regions, plans, or variants?
Watch out
A significant result says some group differs, not which one. Ordinary one-way ANOVA also assumes equal spread across groups; Welch's ANOVA does not.
Precise definition

ANOVA uses a statistical model to compare variation associated with group differences against variation remaining within groups. In a one-way ANOVA, rejecting the null hypothesis indicates that at least one population mean differs, but further comparisons are needed to identify which groups differ.

See also Null Hypothesis, T-test, F-test

Compare between-group and within-group spread
Compare between-group and within-group spreadThe dots show individual observations. The short bars mark group means. ANOVA compares separation among those means with the scatter around them. Variety A Variety B Variety C 3.0 4.5 6.0 7.5 Yield (kg)
The dots show individual observations. The short bars mark group means. ANOVA compares separation among those means with the scatter around them.

F-test

A test that compares two sources of variation, used to judge whether a model or grouping explains more than chance.

Answers
Does adding these predictors genuinely improve the model?
Watch out
It tests whether there is any improvement at all, not whether the improvement is useful.
Precise definition

An F-test uses a statistic with an F distribution under the null hypothesis, often constructed as a ratio of variance estimates or mean squares. Examples include comparing nested linear regression models, testing ANOVA effects, and testing equality of two normal-population variances, each with its own assumptions.

See also Analysis of Variance (ANOVA), Null Hypothesis, Linear Regression

Does a second predictor improve fit?
Does a second predictor improve fit?For nested least-squares fits, the residual sum of squares drops by 24 for one additional coefficient. Relative to the full-model residual mean square of 4, F = 6.ModelResidual SSResidual dfReduced10421Full8020
For nested least-squares fits, the residual sum of squares drops by 24 for one additional coefficient. Relative to the full-model residual mean square of 4, F = 6.

Chi-Square Goodness-of-Fit Test

A test of whether observed category counts match an expected mix.

Answers
Does our customer mix match the market's?
Watch out
The benchmark must give an expected share for every category, and each expected count should be at least about 5.
Precise definition

This test compares observed counts across categories with counts expected under a specified probability model. It uses a chi-square approximation whose validity depends on adequate expected counts, and estimating model parameters from the same data can change the degrees of freedom.

See also Degrees of Freedom

Do the counts match a proposed mix?
Do the counts match a proposed mix?A model assigning equal probability to three categories expects ten observations in each. These observed counts give χ² = 0.8. A B C Category 0 4 8 12 Count Observed Expected
A model assigning equal probability to three categories expects ten observations in each. These observed counts give χ² = 0.8.

Chi-Square Test of Independence

A test of whether two categorical variables are related.

Answers
Is plan type related to churn, or defect rate to production line?
Watch out
It shows that a relationship exists, not how strong it is or what causes it. With small expected counts use Fisher's exact test, and for paired yes/no data use McNemar's test.
Precise definition

This test evaluates whether two categorical variables are associated by comparing observed contingency-table counts with counts expected under independence. It requires independent observational units and an adequate approximation based on expected cell counts; association alone does not establish causation.

Often confused with McNemar's Test · See also Fisher's Exact Test

Compare cell counts under independence
Compare cell counts under independenceThe entries show observed / expected counts for the same 40 plants. With 20 items in each line and 30 passes in total, independence predicts 15 passes in each line. These counts give χ² = 4.8 and p ≈ 0.028.LinePass: obs / expFlag: obs / expA18 / 152 / 5B12 / 158 / 5
The entries show observed / expected counts for the same 40 plants. With 20 items in each line and 30 passes in total, independence predicts 15 passes in each line. These counts give χ² = 4.8 and p ≈ 0.028.

Fisher's Exact Test

A test for a relationship between two categories that stays accurate when counts are small.

Answers
With only a handful of cases, is this difference in rates real?
Watch out
Small samples have low power, so "not significant" here is weak evidence of no effect.
Precise definition

Fisher's exact test evaluates association in a contingency table using an exact conditional distribution, commonly for a 2 × 2 table. It is useful when counts are small and chi-square approximations may be unreliable, though its conclusions still depend on the sampling design and test assumptions.

See also Contingency Table

Condition on the table margins
Condition on the table marginsFour of four A items and one of four B items pass. Given the margins, the one-sided probability of a table at least this favorable to A is 5/70 ≈ 0.071.GroupPassFailTotalA404B134Total538
Four of four A items and one of four B items pass. Given the margins, the one-sided probability of a table at least this favorable to A is 5/70 ≈ 0.071.

McNemar's Test

A test for a change in a yes/no rate when the same people or units are measured twice.

Answers
Did the share who would recommend us change after the redesign, among the same customers?
Watch out
Only units that switched answer count; a chi-square test on the two overall percentages is invalid because the samples are not independent.
Precise definition

McNemar's test compares two proportions measured on the same or matched units, such as a yes/no answer before and after a change. It uses only the discordant pairs, those whose answer changed, and tests whether changes in the two directions are equally likely. An ordinary chi-square test of independence is not valid for such data because the two measurements on a unit are not independent.

Often confused with Chi-Square Test of Independence

Only the customers who switched matter
Only the customers who switched matterOf 100 customers asked twice, 80 gave the same answer both times and carry no information about change. Among the 20 who switched, 15 moved to “recommend” and 5 moved away. An exact binomial test of 5 against 15 gives p ≈ 0.041.Before / afterRecommendNot recommendRecommend405Not recommend1540
Of 100 customers asked twice, 80 gave the same answer both times and carry no information about change. Among the 20 who switched, 15 moved to “recommend” and 5 moved away. An exact binomial test of 5 against 15 gives p ≈ 0.041.

Nonparametric Tests

Tests that avoid assuming a particular distribution such as the normal, often by working on ranks or signs or by reshuffling the data.

Answers
How do we test for differences when the data are ordinal, or when a mean is not the right target?
Watch out
They still make assumptions, such as independent observations, and a rank-based test is not the same test for skewed data: it can answer a different question from a test of means.
Precise definition

Nonparametric tests use formulations that do not require a particular finite-parameter distributional model such as normally distributed outcomes. Many operate on ranks or signs, but they still require assumptions about matters such as independence, exchangeability, or symmetry.

Preserve ordering while dropping the scale
Preserve ordering while dropping the scaleThese two samples have the same ranks. A test statistic based only on those ranks is unchanged by the increase from 20 to 200.Values23720Transformed237200Ranks1234
These two samples have the same ranks. A test statistic based only on those ranks is unchanged by the increase from 20 to 200.

Sign Test

A test that uses only whether each value, or each paired change, is above or below a reference point.

Answers
Did more customers improve than got worse, when ratings can be ordered but not subtracted?
Watch out
It throws away the sizes of the changes, so it needs more data than a t-test or signed-rank test to detect the same effect.
Think of it as
A show of hands: better or worse, with no account of by how much.
Precise definition

The sign test assesses whether a median equals a stated value, or whether paired changes are as likely to be positive as negative, using only the number of observations above and below. Under the null hypothesis that count follows a binomial distribution with probability one-half. Because it ignores magnitudes it needs no symmetry assumption and suits ordinal data, at the cost of lower power.

Often confused with Wilcoxon Signed-Rank Test · See also Null Hypothesis, T-test, Binomial Distribution

Count the directions, ignore the sizes
Count the directions, ignore the sizesTen customers rated a service before and after a change. The two with no change are set aside, leaving 8. If better and worse were equally likely, a split at least as lopsided as 7 to 1 would occur with probability 2 × 9/256 ≈ 0.070.ChangeBetterWorseNo changeCustomers712
Ten customers rated a service before and after a change. The two with no change are set aside, leaving 8. If better and worse were equally likely, a split at least as lopsided as 7 to 1 would occur with probability 2 × 9/256 ≈ 0.070.

Wilcoxon Signed-Rank Test

A rank-based test for paired before-and-after data that does not assume a normal distribution.

Answers
Did the same units tend to change, when the changes are symmetric but include outliers that would dominate an average?
Watch out
It ranks the sizes of the changes, so those sizes must be meaningful, and it assumes the changes are symmetric around their center. For ratings where only better or worse is meaningful, a sign test fits.
Precise definition

The Wilcoxon signed-rank test evaluates paired differences using their signs and the ranks of their absolute magnitudes. It tests a distribution of differences symmetric about zero under the null, so interpreting it as a median-location test requires a symmetry assumption rather than merely an absence of normality. Source ↗

Often confused with Sign Test · See also Normal Distribution, Outlier

Rank magnitudes, then restore signs
Rank magnitudes, then restore signsThe absolute differences 1, 2, 3, and 4 receive ranks 1 through 4. Positive ranks sum to 8 and the negative rank sum in magnitude is 2.Difference+1−2+3+4Signed rank+1−2+3+4
The absolute differences 1, 2, 3, and 4 receive ranks 1 through 4. Positive ranks sum to 8 and the negative rank sum in magnitude is 2.

Mann–Whitney U Test

A rank-based test of whether one of two independent groups tends to have larger values.

Answers
If we pick one customer from each plan at random, is the plan B customer more likely to be the bigger spender?
Watch out
It is not a test of equal means, nor of equal medians unless the two distributions share a shape. It can disagree with a t-test because it asks a different question, not because one of them is wrong.
Precise definition

The Mann–Whitney U test uses ranks to compare two independent samples under a null hypothesis of identical population distributions. It is often interpreted as evidence that one group's values tend to be larger, but interpreting it solely as a median comparison requires additional assumptions about distribution shapes. Source ↗

Often confused with T-test · See also Null Hypothesis

Count pairwise wins
Count pairwise winsFor A = {2, 5} and B = {1, 4, 6}, an A value exceeds a B value in three of the six comparisons. With no ties, this gives U for A of 3.A vs BB = 1B = 4B = 6A = 2WinLossLossA = 5WinWinLoss
For A = {2, 5} and B = {1, 4, 6}, an A value exceeds a B value in three of the six comparisons. With no ties, this gives U for A of 3.

Kruskal–Wallis Test

A rank-based test of whether three or more independent groups differ, without assuming normally distributed data.

Answers
Does some group tend to have higher values than the others, for ratings or when a mean is not the right target?
Watch out
It tells you some group differs, not which, and like Mann–Whitney it is not a test of means, nor of medians unless the groups share a shape.
Precise definition

The Kruskal–Wallis test compares ranks across independent groups to assess evidence against a common population distribution. Interpreting it specifically as a test of medians requires comparable distribution shapes, and a significant overall result does not identify which groups differ. Source ↗

Often confused with Friedman Test

Pool the groups, then rank
Pool the groups, then rankAcross all nine values, group C has the highest average rank. The overall test compares ranks across all three independent groups.GroupObserved valuesPooled ranksMean rankA1, 2, 41, 2, 42.33B3, 5, 63, 5, 64.67C7, 8, 97, 8, 98.00
Across all nine values, group C has the highest average rank. The overall test compares ranks across all three independent groups.

Friedman Test

A rank-based test of whether three or more conditions differ when each unit experienced all of them.

Answers
Do the same stores perform differently under three layouts, judged by their within-store rankings?
Watch out
It says some condition tends to rank differently, not which one, and it is not a test of means or medians.
Precise definition

The Friedman test compares three or more related measurements, such as the same units under several conditions, by ranking the values within each unit and testing whether the average ranks differ between conditions. It is the rank-based counterpart of repeated-measures analysis of variance, and a significant result indicates that some condition tends to rank differently without identifying which.

Often confused with Kruskal–Wallis Test · See also Analysis of Variance (ANOVA)

Rank the options within each store
Rank the options within each storeFive stores each tried three layouts, ranked within each store by sales (1 = lowest). The rank sums are 6, 10, and 14, against 10 each if layout made no difference. The Friedman statistic is 6.4, p ≈ 0.041 by a chi-square approximation that is rough for so few stores.StoreLayout ALayout BLayout C11232132321341235123Rank sum61014
Five stores each tried three layouts, ranked within each store by sales (1 = lowest). The rank sums are 6, 10, and 14, against 10 each if layout made no difference. The Friedman statistic is 6.4, p ≈ 0.041 by a chi-square approximation that is rough for so few stores.

Permutation Test

A test that builds its own reference distribution by shuffling the group labels many times and recomputing the statistic.

Answers
Is this difference in average revenue real, when the samples are too small or too skewed to trust a t-test?
Watch out
It keeps your chosen statistic, such as a difference in means, so unlike a rank-based test it does not change the question; but it assumes the groups are interchangeable if there is no effect.
Think of it as
Dealing the same cards into two hands over and over to see how often a split this lopsided turns up by luck.
Precise definition

A permutation test obtains a p-value by recomputing a chosen statistic, such as a difference in means, over reassignments of the observations to groups, and locating the observed value in that distribution. It relies on the groups being exchangeable under the null hypothesis, which random assignment guarantees, and not on a normal approximation; with many observations a large random sample of reassignments replaces the full enumeration.

Often confused with Bootstrapping · See also Null Hypothesis, P-value, T-test

Shuffle the group labels and recompute
Shuffle the group labels and recomputeGroup A averages 20.25 and group B 10.75, a difference of 9.5. Reassigning the eight values to two groups of four in all 70 possible ways, 4 splits give a difference at least that large in either direction, so p = 4/70 ≈ 0.057. The two humps reflect which group receives the extreme value of 40. −10 −5 0 5 10 Difference in means across all 70 regroupings 0 2 4 6 8 10 12 Number of splits observed Other splits At least as extreme as observed
Group A averages 20.25 and group B 10.75, a difference of 9.5. Reassigning the eight values to two groups of four in all 70 possible ways, 4 splits give a difference at least that large in either direction, so p = 4/70 ≈ 0.057. The two humps reflect which group receives the extreme value of 40.

Shapiro–Wilk Test

A test of whether data are plausibly from a normal distribution.

Answers
Is the normality assumption behind our analysis reasonable?
Watch out
Large samples flag trivial departures and small samples miss big ones. Check the residuals or paired differences a method relies on, not the pooled raw data, and look at a plot as well.
Precise definition

The Shapiro–Wilk test assesses evidence against the hypothesis that observations come from a normal distribution. A small p-value suggests a departure from normality, but a large p-value does not establish normality and the test's sensitivity depends on sample size.

See also P-value, Normal Distribution, Sample Size

A single tail observation changes the order pattern
A single tail observation changes the order patternThe Q–Q plot shows the unusual upper observation. Applying Shapiro–Wilk to the nine plotted values gives W = 0.52 and p < 0.001. -1.6 -0.8 0.0 0.8 1.6 Theoretical normal quantile 3.0 4.5 Ordered observation
The Q–Q plot shows the unusual upper observation. Applying Shapiro–Wilk to the nine plotted values gives W = 0.52 and p < 0.001.

Multiple Comparisons

The problem that running many tests raises the chance of at least one false alarm, by an amount that depends on how many tests there are and how closely related they are.

Answers
We checked twenty segments and one was significant; should we believe it?
Watch out
A 5% threshold per test does not mean a 5% chance of a false alarm overall: for 20 independent tests it is about 64%.
Think of it as
Buy enough lottery tickets and one will win; that does not make it a system.
Precise definition

Multiple comparisons arise when several hypotheses or group contrasts are tested within one analysis. The chance of misleading positive results can grow with the number of tests, so procedures such as Holm adjustment or false-discovery-rate control address an explicitly chosen error criterion.

More tests create more chances for a false alarm
More tests create more chances for a false alarmFor 20 independent tests of true nulls at α = 0.05 each, the chance of at least one false rejection is 1 − 0.95²⁰, about 64%. 0 10 20 30 40 Number of independent tests 0.25 0.50 0.75 P(at least one false alarm)
For 20 independent tests of true nulls at α = 0.05 each, the chance of at least one false rejection is 1 − 0.95²⁰, about 64%.

False Discovery Rate

Among the results you declared significant, the expected share that are false alarms.

Answers
Of the "winning" segments or metrics we flagged, how many are probably flukes?
Watch out
It is not the same as the significance level, which applies to each test separately.
Precise definition

The false discovery rate is the expected proportion of false rejections among all rejected null hypotheses, with the proportion defined as zero when there are no rejections. Procedures such as Benjamini–Hochberg control this quantity under specified conditions when many hypotheses are tested.

See also Significance Level

False results among discoveries
False results among discoveriesOne of five rejected hypotheses is a false discovery in this run, a proportion of 1/5. FDR is the expected value of that proportion over repetitions.RejectedH1H2H3H4H5TruthEffectEffectNullEffectEffect
One of five rejected hypotheses is a false discovery in this run, a proportion of 1/5. FDR is the expected value of that proportion over repetitions.

Relationships, regression, and statistical models

20 terms
Terms in this topic

Correlation

The degree to which two measures move together.

Answers
Do customers who do more of X also tend to do more of Y?
Watch out
It does not show that one causes the other.
Precise definition

Correlation describes an association between variables, with particular coefficients measuring particular types of association. Pearson correlation measures linear association, while rank correlations measure aspects of ordered association; correlation by itself does not establish a causal relationship.

Often confused with Covariance, Correlation vs. Causation

Values that tend to rise together
Values that tend to rise togetherPairs of observations slope upward overall even though several consecutive points fall. Association describes the joint pattern across the sample. 2.5 5.0 7.5 10.0 Feature X 3 6 9 12 Feature Y
Pairs of observations slope upward overall even though several consecutive points fall. Association describes the joint pattern across the sample.

Correlation Analysis

The practice of examining how pairs of variables relate, using charts as well as coefficients.

Answers
Which metrics move together, and how strongly?
Watch out
A single coefficient can hide curves, clusters, and outliers; always plot the data.
Precise definition

Correlation analysis investigates the direction and strength of associations using plots, correlation coefficients, and sometimes inferential tests or intervals. A useful analysis considers outliers, nonlinear patterns, dependence between observations, and possible confounding before interpreting a coefficient.

See also Outlier

Look at the scatter before choosing a coefficient
Look at the scatter before choosing a coefficientThese points follow y = x² exactly. Symmetry gives a Pearson correlation of zero, even though the scatterplot shows a clear relationship. -3.0 -1.5 0.0 1.5 3.0 Feature X 0.0 2.5 5.0 7.5 Feature Y
These points follow y = x² exactly. Symmetry gives a Pearson correlation of zero, even though the scatterplot shows a clear relationship.

Covariance

A measure of whether two variables rise and fall together, in their original units.

Answers
Do these two quantities tend to move in the same direction?
Watch out
Its size depends on the units, so it cannot be compared across pairs; correlation fixes that.
Precise definition

Covariance measures whether two variables tend to deviate from their means in the same or opposite directions. Its magnitude depends on the variables' units, while Pearson correlation standardizes covariance by their standard deviations.

Often confused with Correlation · See also Standard Deviation

The signs of paired deviations
The signs of paired deviationsAll four points lie where the two deviations have the same sign. Their products are positive, giving positive covariance. -4 -2 0 2 4 X minus its mean -3.0 -1.5 0.0 1.5 3.0 Y minus its mean
All four points lie where the two deviations have the same sign. Their products are positive, giving positive covariance.

Pearson Correlation Coefficient

A number from −1 to +1 measuring how closely two variables follow a straight-line relationship.

Answers
How strong is the linear link between these two metrics?
Watch out
A value near zero rules out a straight-line link only; a strong curved relationship can still exist.
Precise definition

The Pearson correlation coefficient is covariance divided by the product of the variables' standard deviations and ranges from −1 to 1 when defined. It measures linear association, so a value near zero can coexist with a strong nonlinear relationship.

Often confused with Spearman Rank Correlation Coefficient · See also Covariance, Standard Deviation

Try the correlation slider ↗

A perfectly negative linear association
A perfectly negative linear associationAll five pairs fall on y = 6 − x, giving Pearson r = −1. Changing the positive units on either axis would preserve this coefficient. 1 2 3 4 5 Feature X 1.5 3.0 4.5 Feature Y
All five pairs fall on y = 6 − x, giving Pearson r = −1. Changing the positive units on either axis would preserve this coefficient.

Spearman Rank Correlation Coefficient

A correlation calculated on ranks, measuring whether two variables consistently rise together, straight line or not.

Answers
Does more of X generally go with more of Y, even if not proportionally?
Watch out
It detects consistent one-directional trends only; a symmetric U-shaped relationship can still score near zero.
Precise definition

Spearman correlation is Pearson correlation applied to the ranks of two variables, with tied values typically assigned average ranks. It measures monotonic association, allowing a curved relationship to produce a strong coefficient if the variables consistently increase or decrease together.

Often confused with Pearson Correlation Coefficient

Consistent order along a curve
Consistent order along a curveThe curve y = x³ is strictly increasing. The ranks match at every point, giving Spearman correlation +1 despite its curvature. 1.5 3.0 4.5 6.0 Feature X 0 100 200 300 Feature Y
The curve y = x³ is strictly increasing. The ranks match at every point, giving Spearman correlation +1 despite its curvature.

Kendall's Tau

A rank-based measure of how consistently two orderings agree.

Answers
Do two rankings, such as two reviewers' scores, put items in the same order?
Watch out
Its values usually differ from Spearman's on the same data, and are often smaller in size, so the two are not directly comparable.
Precise definition

Kendall's tau measures rank association by comparing concordant pairs, whose order agrees between two variables, with discordant pairs, whose order disagrees. Variants such as tau-b account for tied ranks, and the coefficient can describe monotonic association without requiring a linear relationship.

Count pairs whose ordering changes
Count pairs whose ordering changesOnly the B–C pair changes order. With five concordant pairs and one discordant pair, tau is (5 − 1)/6 = 0.67.Ranking 1ABCDRanking 2ACBD
Only the B–C pair changes order. With five concordant pairs and one discordant pair, tau is (5 − 1)/6 = 0.67.

Correlation vs. Causation

Two things moving together does not prove that one causes the other.

Answers
If we do more of X, will Y actually change?
Watch out
The cure is a controlled experiment or careful causal analysis, not a bigger dataset.
Think of it as
Roosters crow before sunrise; they do not make the sun come up.
Precise definition

Correlation means two variables move together; causation means changing one would change the other. A correlation can arise because A causes B, because B causes A, because a third factor drives both, or by coincidence, so observational data alone rarely settle which. Randomized experiments are the most direct way to establish a causal effect.

Often confused with Correlation

Four stories behind one correlation
Four stories behind one correlationSales reps who took the training sell more. Each row is a different explanation that fits that same fact, and only the first means that training more reps would raise sales.Possible explanationTrained reps sell more because…A causes BTraining improves sellingB causes ATop sellers get picked for trainingA third factorExperienced reps do bothCoincidenceThe sample is small and noisy
Sales reps who took the training sell more. Each row is a different explanation that fits that same fact, and only the first means that training more reps would raise sales.

Confounding Variable

A third factor that influences both things being compared, creating a misleading link between them.

Answers
Is something else driving both the cause we suspect and the outcome?
Watch out
Adjusting for the confounders you have measured does not rule out the ones you have not.
Think of it as
Ice-cream sales and sunburn rise together; summer is behind both.
Precise definition

A confounding variable is a factor that distorts an estimated relationship between an exposure and an outcome, commonly because it influences both. For example, season could confound the relationship between electricity use and crop yield if seasonal conditions affect both quantities.

Often confused with Simpson's Paradox

Season can affect both variables
Season can affect both variablesSeason can change both electricity consumption and crop yield. The dashed arrow is the relationship of interest: the observed association can mix a real effect with the seasonal one.?SeasonElectricity useYield
Season can change both electricity consumption and crop yield. The dashed arrow is the relationship of interest: the observed association can mix a real effect with the seasonal one.

Simpson's Paradox

A trend seen in every subgroup can reverse when the subgroups are combined.

Answers
Why does the overall number say the opposite of every segment?
Watch out
Neither view is automatically right; which to trust depends on what drives group membership.
Precise definition

Simpson's paradox occurs when a trend that appears within each of several groups weakens, disappears, or reverses when the groups are combined. It arises when group membership is related to both variables being compared, so the pooled comparison mixes the within-group relationship with differences between the groups.

Often confused with Confounding Variable

The trend reverses when groups are pooled
The trend reverses when groups are pooledWithin each region, higher prices go with lower sales (solid lines). Pooled, the dashed line slopes upward, because the premium region has both higher prices and higher volumes. 10 12 14 16 18 20 Price ($) 50 60 70 80 90 Units sold per week Standard region Premium region All stores pooled
Within each region, higher prices go with lower sales (solid lines). Pooled, the dashed line slopes upward, because the premium region has both higher prices and higher volumes.

Regression to the Mean

Extreme results tend to be followed by more ordinary ones, purely by chance.

Answers
Did our intervention work, or would the worst performers have improved anyway?
Watch out
Targeting the worst performers and then measuring them again almost guarantees apparent improvement.
Think of it as
A record-breaking month is usually part skill and part luck, and the luck rarely repeats.
Precise definition

Regression to the mean is the tendency for unusually high or low measurements to be followed by values closer to the average, whenever results combine a stable component with chance variation. It happens without any intervention, so improvement after a bad period, or decline after a record one, is not by itself evidence that an action worked.

Extreme results drift back toward average
Extreme results drift back toward averageForty simulated stores each have a stable level plus quarterly luck. The five best in quarter 1 averaged 117 and fell to 109 in quarter 2; the five worst rose from 82 to 92. Nothing was changed between quarters. Quarter 1 Quarter 2 70 80 90 100 110 120 130 Sales index (average = 100) Top 5 in quarter 1 Bottom 5 in quarter 1
Forty simulated stores each have a stable level plus quarterly luck. The five best in quarter 1 averaged 117 and fell to 109 in quarter 2; the five worst rose from 82 to 92. Nothing was changed between quarters.

Regression

A family of methods that relate an outcome to one or more inputs.

Answers
Which factors are associated with the outcome, and by how much?
Watch out
In machine learning the word narrows to "predicting a number", which differs from the broader statistical sense.
Precise definition

Regression is a family of methods for modeling how a response variable's expected value or other distributional features depend on predictors. In machine learning, the term often refers more narrowly to predicting a numerical outcome, although statistical regression also includes models for binary and count responses.

See also Expected Value

Predict a numerical response
Predict a numerical responseThis example predicts mean cycle time from load. At load level 5 the predicted cycle time is 18 seconds. 1.5 3.0 4.5 6.0 Robot load level 12 16 20 Cycle time (s)
This example predicts mean cycle time from load. At load level 5 the predicted cycle time is 18 seconds.

Linear Regression

Fitting a straight-line relationship to predict a number from one or more inputs.

Answers
How much does the outcome change, on average, for each unit increase in an input?
Watch out
A fitted line describes association within the observed range; it is not proof of cause, and it extrapolates poorly.
Precise definition

Linear regression models a numerical response as a linear combination of coefficients and predictor terms, usually with an added error term. Linear refers to the coefficients, so the predictor terms may include squares or interactions without making the model nonlinear in its parameters.

Fit a line through paired measurements
Fit a line through paired measurementsThe fitted slope estimates the expected change in Y per additional unit of X. Vertical departures from the line are residuals. 2.5 5.0 7.5 10.0 Feature X 3 6 9 12 Response Y
The fitted slope estimates the expected change in Y per additional unit of X. Vertical departures from the line are residuals.

Residual

The gap between what actually happened and what the model predicted.

Answers
Where and by how much is the model wrong?
Watch out
Patterns in the residuals mean the model is missing something systematic.
Precise definition

A residual is the difference between an observed response and its fitted value, commonly written y − ŷ. Residuals are observable after fitting and help diagnose a model, whereas the underlying statistical errors relative to the true model are generally unobserved.

Measure the vertical gap
Measure the vertical gapAt x = 4 the observed value is 11 and the fitted value is 9. The dashed segment represents the residual 11 − 9 = +2. 1 2 3 4 5 Predictor x 5.0 7.5 10.0 Response
At x = 4 the observed value is 11 and the fitted value is 9. The dashed segment represents the residual 11 − 9 = +2.

R-squared

The share of variation in the outcome that the model accounts for.

Answers
How much of the ups and downs in the outcome does our model explain?
Watch out
A high value does not mean the model is correct or will predict new data well. On the training data it never falls when an input is added, even a useless one.
Precise definition

R-squared commonly equals 1 minus the residual sum of squares divided by the total sum of squares around the observed mean. It describes improvement over that mean-based reference on the evaluated data, can be negative for some models or held-out predictions, and does not establish causality or guarantee good future predictions.

Try the correlation slider ↗

Compare squared error with the mean baseline
Compare squared error with the mean baselineIf the baseline sum of squares is 100 and the fitted model leaves 25, R² = 1 − 25/100 = 0.75. Mean baseline Fitted model 0 30 60 90 Sum of squared errors
If the baseline sum of squares is 100 and the fitted model leaves 25, R² = 1 − 25/100 = 0.75.

Multiple Linear Regression

A regression with several inputs at once, estimating each one's effect with the others held fixed.

Answers
What is the effect of price on sales after accounting for advertising and season?
Watch out
"Holding other things fixed" covers only the variables in the model, and closely related inputs give unstable estimates.
Precise definition

Multiple linear regression models a numerical outcome using two or more predictors in a linear combination of coefficients. Each coefficient describes an association conditional on the other included predictors, and that adjustment alone does not establish causality.

See also Linear Regression

Hold the other predictor fixed
Hold the other predictor fixedFor predicted weight = 40 + 3 × days + 2 × light hours, going from 20 to 21 days adds 3 g at the same light setting.DaysLight hoursPredicted grams201012021101232112127
For predicted weight = 40 + 3 × days + 2 × light hours, going from 20 to 21 days adds 3 g at the same light setting.

Regression Analysis

The full process of fitting a regression model and checking that it can be trusted.

Answers
Can we rely on what this model says about the drivers of the outcome?
Watch out
Reading coefficients without checking the residuals and assumptions is the most common mistake.
Precise definition

Regression analysis is the full process of specifying, fitting, interpreting, and checking a regression model. It includes evaluating residual patterns, uncertainty, influential observations, assumptions, and whether the study design supports the conclusions being drawn.

Check what the fitted model missed
Check what the fitted model missedThe residuals form a U shape around zero. This diagnostic suggests that a straight-line model missed curvature in the relationship. 2 4 6 8 Fitted response -1.5 0.0 1.5 Residual
The residuals form a U shape around zero. This diagnostic suggests that a straight-line model missed curvature in the relationship.

Logistic Regression

A model that estimates the probability of a yes/no outcome from several inputs.

Answers
What drives the likelihood that a customer converts, churns, or defaults?
Watch out
Its coefficients change the odds, not the probability directly, so effects are not constant percentage points.
Precise definition

Logistic regression models the log-odds of a binary outcome as a linear combination of predictors. Applying the logistic sigmoid converts that value into a probability. It is often used for classification by applying a threshold to that probability, which is why a method named regression appears in classification work.

See also Likelihood

Convert a linear predictor to a probability
Convert a linear predictor to a probabilityWith intercept 0 and coefficient 1, the predicted probability is 0.50 at x = 0 and about 0.88 at x = 2. -4 -2 0 2 4 Predictor x 0.0 0.3 0.6 0.9 P(class = 1)
With intercept 0 and coefficient 1, the predicted probability is 0.50 at x = 0 and about 0.88 at x = 2.

Generalized Linear Model (GLM)

A family of regression models that extends ordinary linear regression to outcomes such as yes/no results or counts.

Answers
How do we model the drivers of a conversion (yes/no) or a number of claims (count)?
Watch out
Outside ordinary linear regression (itself a GLM), coefficients act on a transformed scale: log-odds in logistic models, the log of the expected count in Poisson models.
Precise definition

A generalized linear model connects the expected response to a linear predictor through a link function and specifies a response distribution from the exponential family. Logistic regression for binary data and Poisson regression for counts are examples, and a GLM does not inherently include random effects.

See also Logistic Regression, Linear Regression

A straight predictor yields a curved count mean
A straight predictor yields a curved count meanIn a Poisson GLM with log link, log(μ) = 0.5 + 0.6x. Applying the inverse link gives μ = exp(0.5 + 0.6x), the curve shown here. 0.0 0.8 1.6 2.4 Exposure setting x 2.5 5.0 7.5 10.0 Expected count
In a Poisson GLM with log link, log(μ) = 0.5 + 0.6x. Applying the inverse link gives μ = exp(0.5 + 0.6x), the curve shown here.

Analysis of Covariance (ANCOVA)

A comparison of group averages after adjusting for another measured factor.

Answers
Do regions differ in sales once we account for store size?
Watch out
Adjustment only handles the factors you measured and included.
Precise definition

ANCOVA is a linear modeling approach that compares group means while adjusting for other measured variables called covariates. For example, it could compare harvest weight across lettuce varieties while adjusting for growing time; a conventional model assumes a common covariate slope unless interactions are included.

Compare varieties at the same growing time
Compare varieties at the same growing timeAt day 24 the example model predicts 136 g for A and 146 g for B. Their adjusted difference is 10 g under the common-slope assumption. 18 21 24 27 30 Growing time (days) 120 140 160 Predicted weight (g) Variety A Variety B
At day 24 the example model predicts 136 g for A and 146 g for B. Their adjusted difference is 10 g under the common-slope assumption.

Mixed-Effects Model

A regression for grouped data that allows each group, such as a store or customer, its own baseline.

Answers
What is the overall effect once we account for repeated measurements on the same stores or customers?
Watch out
Ignoring the grouping and using ordinary regression overstates how certain the results are.
Precise definition

A mixed-effects model combines fixed effects describing population-level relationships with random effects describing variation among groups such as beds, rooms, or production cycles. It models dependence within groups and shares information through partial pooling, while predictions for a new group differ from predictions for a previously observed group.

A common slope with bed-specific intercepts
A common slope with bed-specific interceptsIn this fitted example, each bed shares a slope of 2 g per day. Random intercepts place the two bed predictions above and below the population line. 2 4 6 8 Additional growing days 112 120 128 Predicted weight (g) Population Bed A Bed B
In this fitted example, each bed shares a slope of 2 g per day. Random intercepts place the two bed predictions above and below the population line.

Data preparation and features

11 terms
Terms in this topic

Data Pre-processing

Cleaning and reshaping raw data so a model can use it.

Answers
What must be done to this data before it can be analyzed?
Watch out
Any step that learns from the data, such as scaling, must be fitted on training data only.
Precise definition

Data pre-processing prepares raw observations for analysis through operations such as cleaning, encoding, scaling, and handling missing values. Any transformation that learns from data should be fitted on the training portion within each split and then applied to held-out data to avoid leakage.

See also Missing Values

Prepare a consistent measurement
Prepare a consistent measurementThe pipeline parses a text field, converts its unit, and supplies a numerical model input. The same rule applies to future rows.“0.15 kg”Raw field0.15 × 1000Convert units150Weight in grams
The pipeline parses a text field, converts its unit, and supplies a numerical model input. The same rule applies to future rows.

Missing Values

Entries that were never recorded.

Answers
What do we do about the gaps in our data?
Watch out
Missing is not zero, and the reason data are missing often carries information itself.
Precise definition

Missing values are unobserved or unavailable entries in a dataset, rather than necessarily zeros or empty categories. Their cause matters because deletion or imputation can introduce bias when missingness is related to observed or unobserved quantities.

Keep an absent reading distinct from zero
Keep an absent reading distinct from zeroAt 09:00 the meter reported zero. At 10:00 it returned no reading, which conveys different information.TimeMeter valueStatus08:004.2Observed09:000.0Observed10:00—Missing
At 09:00 the meter reported zero. At 10:00 it returned no reading, which conveys different information.

Outlier

A value far from the rest of the data.

Answers
Is this unusual figure an error, a one-off, or something important?
Watch out
Deleting outliers because they are inconvenient can remove the most important cases.
Precise definition

An outlier is an observation unusually far from other observations or from what a fitted model expects. It may reflect a recording error, an unusual but valid event, or a missing explanatory factor, so exclusion should follow a justified rule rather than convenience.

Often confused with Anomaly Detection

One cycle is much longer
One cycle is much longerSix robot cycles take about 8–9 seconds. The 17-second cycle merits inspection of the machine log before deciding how to handle it. 8 10 12 14 16 Cycle time (s)
Six robot cycles take about 8–9 seconds. The 17-second cycle merits inspection of the machine log before deciding how to handle it.

Feature Engineering

Creating more useful model inputs from raw data.

Answers
What can we derive from the raw fields that would help prediction?
Watch out
A feature that would not be known at prediction time makes the model look better than it is.
Precise definition

Feature engineering creates or transforms model inputs so they better represent useful aspects of the problem. Examples include deriving weekend hours, creating a temperature lag, or expressing harvest weight per growing day, provided the information would be available when the prediction is made.

Turn a timestamp into usable predictors
Turn a timestamp into usable predictorsBoth rows fall at 08:00. Deriving the day type lets a model distinguish a weekday run from a weekend run.TimestampHourWeekend flagMon 08:0080Sat 08:0081
Both rows fall at 08:00. Deriving the day type lets a model distinguish a weekday run from a weekend run.

One-Hot Encoding

Turning a category into a set of yes/no columns, one per option.

Answers
How do we feed a category such as region or product into a model that needs numbers?
Watch out
Coding categories as 1, 2, 3 instead implies an order and spacing that do not exist.
Precise definition

One-hot encoding represents a categorical value using indicator columns, with one active column for the observed category. In linear models with an intercept, a reference category is commonly omitted to avoid redundant columns and non-identifiable coefficients.

One indicator per crop variety
One indicator per crop varietyThe active indicator identifies the variety. The three indicator columns carry no numerical ranking of the categories.VarietyBibbRomaineOakleafBibb100Romaine010Oakleaf001
The active indicator identifies the variety. The three indicator columns carry no numerical ranking of the categories.

Normalization

Rescaling values to a common range, such as 0 to 1.

Answers
How do we put inputs measured in different units on a comparable footing?
Watch out
The word is used loosely for several different rescalings; check which one is meant.
Precise definition

Normalization rescales data according to a chosen convention, such as mapping a feature into a fixed range or making each vector have unit length. The term is used inconsistently, so distinguish it from standardization, which commonly subtracts a mean and divides by a standard deviation.

Often confused with Standardization · See also Standard Deviation

Map a feature onto the unit interval
Map a feature onto the unit intervalFor a training range of 10 to 30, the min–max rule is (x − 10)/20. It maps 20 exactly to the midpoint.Original1015202530Normalized0.25.50.751
For a training range of 10 to 30, the min–max rule is (x − 10)/20. It maps 20 exactly to the midpoint.

Standardization

Rescaling a variable so its average is 0 and its standard deviation is 1.

Answers
How do we compare or combine inputs on very different scales?
Watch out
It changes the units, not the shape: skewed data stay skewed.
Precise definition

Standardization commonly transforms a feature by subtracting its mean and dividing by its standard deviation, giving a z-score scale when the standard deviation is nonzero. For predictive modeling, the mean and standard deviation should be learned from training data and reused for validation, test, and future observations.

Often confused with Normalization · See also Standard Deviation, Z-score

Express a feature on a z-score scale
Express a feature on a z-score scaleUsing training mean 150 g and standard deviation 10 g maps 140, 150, and 170 g to −1, 0, and +2.Weight (g)140150170z-score−10+2
Using training mean 150 g and standard deviation 10 g maps 140, 150, and 170 g to −1, 0, and +2.

Imbalanced Data

Data where one outcome is far rarer than the other, such as fraud.

Answers
How do we build and judge a model when the event we care about is rare?
Watch out
Accuracy is misleading here: predicting "never" scores highly and is useless.
Precise definition

Imbalanced data contain substantially different numbers of examples across outcome classes. A classifier can achieve high overall accuracy by favoring the majority class, so evaluation should also consider minority-class performance, thresholds, and the costs of different errors.

A rare defect class
A rare defect classWith 95 normal and 5 defective items, predicting normal for every item yields 95% accuracy and catches zero defects. Normal Defective 0 25 50 75 Number of items
With 95 normal and 5 defective items, predicting normal for every item yields 95% accuracy and catches zero defects.

Oversampling

Repeating or synthesizing examples of a rare class so the model pays more attention to it.

Answers
How do we help a model learn a rare outcome?
Watch out
It must be applied to the training data only, and it distorts the model's predicted probabilities.
Precise definition

Oversampling increases the representation of selected observations or classes, often by duplicating minority-class examples or generating synthetic ones. It should occur only within training partitions, because resampling before splitting can leak information and produce misleading evaluation results.

Rebalance the training partition
Rebalance the training partitionDuplicating the minority training examples increases their influence during fitting. The held-out test partition keeps its original class composition.PartitionPassDefectTrain, original808Train, oversampled8080Test202
Duplicating the minority training examples increases their influence during fitting. The held-out test partition keeps its original class composition.

Padding

Adding filler so that inputs of different lengths line up to the same size.

Answers
How do we batch together texts or sequences of different lengths?
Watch out
The model must be told to ignore the filler, or it will treat it as content.
Precise definition

Padding adds extra values or tokens to an input, often to equalize sequence lengths in a batch or control the size of convolution outputs. Sequence models generally need a mask or equivalent mechanism so padding does not act like meaningful content.

Often confused with Truncation

Align sequences in a batch
Align sequences in a batchThe short sequence gets two padding tokens. Its mask marks the first two positions as real inputs.Sequence AcuttheleafnowSequence BcutleafPADPADMask for B1100
The short sequence gets two padding tokens. Its mask marks the first two positions as real inputs.

Truncation

Cutting off whatever exceeds a limit, such as text beyond a maximum length.

Answers
What happens to input that is too long for the system?
Watch out
What gets cut may hold the key information, and nothing warns you that it was dropped.
Precise definition

In data processing, truncation removes values or sequence elements beyond a chosen limit, such as shortening text to a maximum token count. In statistics, a truncated sample entirely excludes observations outside a selection range, unlike censoring, where their existence and a bound are still recorded.

Often confused with Padding

A four-token string with a three-token limit
A four-token string with a three-token limitKeeping the first three tokens drops the final word, which can change the information available to the model.InputvalvedidnotopenRetainedvalvedidnot
Keeping the first three tokens drops the final word, which can change the information available to the model.

Learning workflow and model development

20 terms
Terms in this topic

Supervised Learning

Learning to predict an outcome from examples where the right answer is known.

Answers
Can we predict this outcome from past cases where we know what happened?
Watch out
The model can only be as good as its labels; biased or wrong labels are learned faithfully.
Precise definition

Supervised learning fits a mapping from inputs to target outputs using examples for which those targets are known. Classification and numerical prediction are common forms, and success is assessed using observations that were not used to fit or select the model.

Learn from inputs paired with targets
Learn from inputs paired with targetsEach training row includes a known harvested weight. The trained model receives a new row of inputs and predicts its unknown target.DaysLight hoursTarget weight1812130 g2212145 g2514160 g2313Predict
Each training row includes a known harvested weight. The trained model receives a new row of inputs and predicts its unknown target.

Unsupervised Learning

Finding structure in data without any known right answers.

Answers
Are there natural groupings or patterns in our data that we have not labeled?
Watch out
The patterns found are suggestions that need interpreting; there is no answer key to check them against.
Precise definition

Unsupervised learning seeks structure in data without supplied target labels for the task. Examples include clustering, dimensionality reduction, and density estimation, and the resulting patterns require interpretation and validation rather than being automatically meaningful.

See also Clustering

Inspect structure without labels
Inspect structure without labelsOnly two numerical features are supplied. The point cloud suggests two groups that a clustering algorithm could investigate. 0.8 1.6 2.4 3.2 Feature 1 0.6 1.2 1.8 2.4 Feature 2
Only two numerical features are supplied. The point cloud suggests two groups that a clustering algorithm could investigate.

Classification

Predicting which category something belongs to.

Answers
Will this customer churn or not? Is this transaction fraud?
Watch out
Most classifiers produce a score; the yes/no decision depends on a threshold you choose.
Precise definition

Classification predicts which category an observation belongs to, often by first estimating probabilities or scores for the available classes. Binary classification uses two classes, multiclass classification chooses among more than two, and multilabel classification allows several labels for one observation.

Often confused with Clustering · See also Multiclass Classification

Try the threshold slider ↗

Assign one class to a new item
Assign one class to a new itemA binary model scores a leaf image at 0.78 for damage. A threshold of 0.50 assigns the damaged class.Leaf imageP(damage)0.78DecisionDamaged
A binary model scores a leaf image at 0.78 for damage. A threshold of 0.50 assigns the damaged class.

Multiclass Classification

Predicting one category from three or more options.

Answers
Which of several products, intents, or fault types is this?
Watch out
Overall accuracy can hide a class the model almost never gets right.
Precise definition

Multiclass classification assigns each example to one of more than two possible classes. It differs from multilabel classification, where one example may belong to several classes simultaneously.

Pick one of three varieties
Pick one of three varietiesThe three class probabilities sum to one. The largest probability, 0.65, assigns the specimen to Romaine. Bibb Romaine Oakleaf 0.0 0.2 0.4 0.6 Predicted probability
The three class probabilities sum to one. The largest probability, 0.65, assigns the specimen to Romaine.

Train–Test Split

Setting aside part of the data to test the model on cases it has never seen.

Answers
How do we get an honest estimate of real-world performance?
Watch out
For data ordered in time, the test set must come after the training set.
Think of it as
Homework to learn from, a final exam to be graded on.
Precise definition

A train–test split separates data used to fit a model from data reserved to assess its performance on unseen observations. Random splitting suits some independent datasets, while grouped or temporal data require splits that prevent information from related records or the future from leaking across the boundary.

Often confused with Validation Set

Train on earlier cycles, test on later ones
Train on earlier cycles, test on later onesFor a forecasting task, cycles 1–4 fit the model. Cycles 5–6 simulate predictions on future cycles.Cycle123456RoleTrainTrainTrainTrainTestTest
For a forecasting task, cycles 1–4 fit the model. Cycles 5–6 simulate predictions on future cycles.

Validation Set

Data held back to tune and compare models, separate from the final test data.

Answers
Which version of the model is best, before the final check?
Watch out
Once used for choosing, it no longer gives an unbiased score; that is what the test set is for.
Think of it as
The mock exam, taken before the final.
Precise definition

A validation set is held-out data used during development to compare models, choose hyperparameters, or decide when to stop training. Because these choices adapt to its results, it serves a different purpose from a final test set reserved for independent evaluation.

Often confused with Train–Test Split · See also Hyperparameter

Three partitions with distinct jobs
Three partitions with distinct jobsTraining fits coefficients. Validation selects a candidate. The test partition evaluates that selected candidate once the choices are fixed.Data block123456RoleTrainTrainTrainValValTest
Training fits coefficients. Validation selects a candidate. The test partition evaluates that selected candidate once the choices are fixed.

Cross-validation

Testing a model several times on different held-out slices of the data.

Answers
How well will this model perform on data it has not seen, and how stable is that estimate?
Watch out
Random splitting gives over-optimistic scores for time-ordered or grouped data.
Think of it as
Rotating which chapter is the exam, so every chapter gets tested once.
Precise definition

Cross-validation repeatedly trains and evaluates a model on different partitions of the available data to estimate performance and support model selection. The partitions must respect the data structure, such as keeping a person's records together or ensuring that future observations do not enter a time-series training set.

See also Model Selection

Rotate the held-out fold
Rotate the held-out foldIn four-fold cross-validation, each block supplies validation data once. Fit preprocessing and the model anew on the other three blocks in each row.Round 1ValTrainTrainTrainRound 2TrainValTrainTrainRound 3TrainTrainValTrainRound 4TrainTrainTrainVal
In four-fold cross-validation, each block supplies validation data once. Fit preprocessing and the model anew on the other three blocks in each row.

Data Leakage

When information the model would not have in real use sneaks into its training.

Answers
Why does the model score brilliantly in testing and poorly in production?
Watch out
Suspiciously good results are the main warning sign; leakage is easy to cause and hard to spot.
Think of it as
Seeing the answer key before the exam.
Precise definition

Data leakage occurs when model development uses information that would be unavailable at the time of prediction or should be reserved for independent evaluation. Examples include scaling on the full dataset before cross-validation, including future measurements, or placing near-duplicate records in both training and test sets.

See also Cross-validation

Check the clock on each predictor
Check the clock on each predictorFor a 07:00 forecast, a 06:00 sensor reading is available. A measurement collected at harvest would give the model future information.When knownFeatureUsable at 07:00?06:00TemperatureYes14:00Harvest massNo
For a 07:00 forecast, a 06:00 sensor reading is available. A measurement collected at harvest would give the model future information.

Underfitting

A model too simple to capture the real pattern.

Answers
Why is the model poor even on the data it was trained on?
Watch out
More data will not help; the model needs more flexibility or better inputs.
Precise definition

Underfitting occurs when a model cannot capture important structure in the data, often because its representation is too restrictive or its training is inadequate. It tends to produce poor performance on both training and validation data, and excessive regularization can be one cause.

Often confused with Overfitting · See also Regularization

Try the flexibility slider ↗

A flat model misses the curvature
A flat model misses the curvatureA constant predictor systematically overpredicts the center and underpredicts both ends. Even the training data expose this mismatch. -2 -1 0 1 2 Predictor 0.0 1.5 3.0 Response Observed Constant fit
A constant predictor systematically overpredicts the center and underpredicts both ends. Even the training data expose this mismatch.

Overfitting

A model that has memorized quirks of its training data and so performs worse on new data.

Answers
Why is the model excellent on historical data and disappointing live?
Watch out
A better fit to past data is not evidence of a better model.
Think of it as
Memorizing the practice exam rather than learning the subject.
Precise definition

Overfitting occurs when a model captures training-specific noise or accidental patterns that do not transfer well to new data. It often appears as much better training performance than validation performance and can be reduced through suitable model complexity, regularization, and more informative data.

Often confused with Underfitting · See also Regularization

Training and validation errors diverge
Training and validation errors divergeBeyond complexity level 3, training error continues to fall while validation error rises. The extra flexibility hurts performance on unseen cases in this example. 1.5 3.0 4.5 6.0 Model complexity 0.0 2.5 5.0 7.5 Error Training Validation
Beyond complexity level 3, training error continues to fall while validation error rises. The extra flexibility hurts performance on unseen cases in this example.

Bias–Variance Tradeoff

The balance between a model too simple to see the pattern and one so flexible it chases noise.

Answers
How complex should the model be?
Watch out
Reducing one kind of error usually increases the other; the aim is the lowest total on new data.
Think of it as
Darts: consistently off-center is bias, scattered all over is variance.
Precise definition

The bias–variance tradeoff describes two sources of prediction error: bias, from a model too simple to capture the real pattern, and variance, from a model so flexible that it changes substantially with the particular training sample. Increasing complexity typically lowers bias and raises variance, and the best expected performance on new data comes from balancing the two.

Try the flexibility slider ↗

Four ways to hit or miss a target
Four ways to hit or miss a targetEach dot is the prediction of a model trained on a different sample; the center is the truth. Low bias centers the shots on the bullseye, and low variance keeps them close together. An underfit model misses consistently; an overfit one scatters.Low biaslow varianceIdealHigh biaslow varianceUnderfitLow biashigh varianceOverfitHigh biashigh varianceWorst of both
Each dot is the prediction of a model trained on a different sample; the center is the truth. Low bias centers the shots on the bullseye, and low variance keeps them close together. An underfit model misses consistently; an overfit one scatters.

Generalization

A model's ability to perform well on new data, not just the data it learned from.

Answers
Will this work on next quarter's customers, or in a new market?
Watch out
Good test scores only cover conditions like those in the data; new conditions need new evidence.
Precise definition

Generalization is a model's ability to perform well on new observations beyond those used to fit it. Performance on data similar to the training population does not automatically imply good performance after a change in location, equipment, population, or operating conditions.

Test the model on a new growing cycle
Test the model on a new growing cycleIllustrative errors increase from 4 g on training observations to 6 g on a new cycle and 11 g at a new farm. Deployment conditions determine which test is relevant. Training New cycle New farm 0 3 6 9 Mean absolute error (g)
Illustrative errors increase from 4 g on training observations to 6 g on a new cycle and 11 g at a new farm. Deployment conditions determine which test is relevant.

Hyperparameter

A setting chosen before training that shapes how a model learns, as opposed to what it learns.

Answers
Which dials can we turn to improve the model?
Watch out
Tuning these on the test set quietly inflates reported performance.
Precise definition

A hyperparameter controls a model's structure or training procedure, such as tree depth, learning rate, or regularization strength. It is usually selected using domain knowledge or validation results, while ordinary model parameters are fitted within the training procedure.

Often confused with Parameter · See also Regularization, Learning Rate

A setting and the structure it permits
A setting and the structure it permitsIn a binary tree, depth limits the maximum number of leaves. Training chooses the split rules within that limit.Maximum depthMaximum leaves122438
In a binary tree, depth limits the maximum number of leaves. Training chooses the split rules within that limit.

Model Selection

Choosing among candidate models or settings.

Answers
Which model should we deploy?
Watch out
The model that wins on validation data has been flattered by the selection; re-check it on fresh data.
Precise definition

Model selection chooses among candidate models, feature sets, or hyperparameter settings using criteria such as validation performance or information criteria. Repeatedly selecting against the same test set makes that set part of the selection process and weakens its value as an independent assessment.

See also Hyperparameter

Choose on validation performance
Choose on validation performanceOf three candidate models, B has the smallest validation error. An independent test set can then assess the selected model. A B C 0.0 1.5 3.0 4.5 Validation error (g)
Of three candidate models, B has the smallest validation error. An independent test set can then assess the selected model.

Model Evaluation

Measuring how well a model does the job it is meant for.

Answers
Is this model good enough to use, and where does it fail?
Watch out
A single headline metric hides who the model fails for and what the errors cost.
Precise definition

Model evaluation assesses how well a model meets its intended goals using appropriate data, metrics, and diagnostic checks. It should examine performance beyond the training sample and may include uncertainty, calibration, subgroup behavior, and the consequences of different errors.

See also Calibration

Score the same held-out predictions several ways
Score the same held-out predictions several waysFor absolute errors 1, 2, and 3 g, the mean absolute error is 2 g and the largest error is 3 g. Each summary answers a different evaluation question.Held-out caseABCAbsolute error1 g2 g3 gObserved mass20 g26 g30 gPrediction19 g24 g27 g
For absolute errors 1, 2, and 3 g, the mean absolute error is 2 g and the largest error is 3 g. Each summary answers a different evaluation question.

Inductive Bias

The built-in assumptions that lead a model to prefer some explanations over others.

Answers
Why do different model types give different answers from the same data?
Watch out
Every model has assumptions; no method is neutral or assumption-free.
Precise definition

Inductive bias is the set of assumptions or preferences that helps a learning algorithm choose among explanations consistent with its training data. Examples include favoring smooth functions, sparse coefficients, or local image patterns, and these preferences affect what the model can generalize well.

Two curves fit the same three points
Two curves fit the same three pointsA learner that favors straight lines chooses the solid curve. A more flexible learner can also fit the dashed curve through every training point. 0.0 0.5 1.0 1.5 2.0 Input 1.2 1.8 2.4 3.0 Output Straight line Bent curve
A learner that favors straight lines chooses the solid curve. A more flexible learner can also fit the dashed curve through every training point.

Feature Importance

A ranking of which inputs a model relies on most.

Answers
What is driving the model's predictions?
Watch out
Importance to the model is not cause in the real world; changing that input may not change the outcome.
Precise definition

Feature importance scores estimate how much each input contributes to a model's predictions, for example by measuring how much accuracy drops when a feature's values are shuffled. The scores describe what the model relies on, not what causes the outcome, and correlated features can share or swap importance in unstable ways.

Which inputs does the churn model lean on?
Which inputs does the churn model lean on?In this illustrative churn model, shuffling days since last order cuts accuracy by 14 points, far more than any other input. Region barely affects the model's predictions. 0 2 4 6 8 10 12 14 Drop in accuracy when the feature is shuffled (points) Region Account tenure Discount used Support tickets Days since last order
In this illustrative churn model, shuffling days since last order cuts accuracy by 14 points, far more than any other input. Region barely affects the model's predictions.

Data Drift

The world changing after the model was trained, so its inputs or their meaning no longer match.

Answers
Is the model still seeing the kind of data it was built for?
Watch out
Models decay silently; without monitoring, the first sign is usually a business problem.
Think of it as
A map that was accurate when printed, used after the roads have moved.
Precise definition

Data drift is a change over time in the distribution of a model's inputs, or in the relationship between inputs and outcome (often called concept drift), relative to the data the model was trained on. Because a model's accuracy is only assured for conditions resembling its training data, drift is a common cause of gradual performance decay and a reason to monitor deployed models.

Live inputs move away from the training data
Live inputs move away from the training dataThe model was trained when order values centered near $50. This month they center near $62, so a growing share of live cases lies where the model saw little training data. 20 40 60 80 100 Order value ($) 0.00 0.01 0.02 0.03 0.04 Density Training data Live data this month
The model was trained when order values centered near $50. This month they center near $62, so a growing share of live cases lies where the model saw little training data.

Human in the Loop

A setup where people review, correct, or approve what a model produces.

Answers
Where should a person check the model's work?
Watch out
Reviewers tend to rubber-stamp a model that is usually right, so the review must be designed, not assumed.
Precise definition

Human in the loop describes a system in which people participate in labeling, reviewing, correcting, or deciding alongside an automated model. The human role should be explicit, including which cases require review and how feedback changes the system.

Route uncertain labels to a reviewer
Route uncertain labels to a reviewerA reviewer inspects cases that fall below the confidence threshold. Confirmed labels can later enter a reviewed training set.Model scoreHigh confidenceLow confidenceAuto-labelReview
A reviewer inspects cases that fall below the confidence threshold. Confirmed labels can later enter a reviewed training set.

Prediction and retrieval metrics

13 terms
Terms in this topic

Confusion Matrix

A table of what the model predicted against what actually happened.

Answers
What kinds of mistakes is the model making, and how many of each?
Watch out
The counts change with the decision threshold, so one matrix shows one operating point only.
Precise definition

A confusion matrix cross-tabulates a classifier's predicted labels against the actual labels. In binary classification it records true positives, false positives, true negatives, and false negatives, from which metrics such as precision and recall are calculated.

See also Recall

Account for all 20 predictions
Account for all 20 predictionsRead down a column for predicted labels and across a row for actual labels. The off-diagonal cells contain three false positives and two false negatives.Actual / predictedPositiveNegativePositive6 TP2 FNNegative3 FP9 TN
Read down a column for predicted labels and across a row for actual labels. The off-diagonal cells contain three false positives and two false negatives.

Accuracy

The share of predictions the model got right.

Answers
How often is the model correct overall?
Watch out
With rare events it is misleading: a model that never predicts fraud can be 99% accurate.
Precise definition

Classification accuracy is the fraction of evaluated examples whose predicted labels match their actual labels. It is easy to interpret but can conceal poor performance on a rare class, so its usefulness depends on class frequencies and the costs of different mistakes.

Often confused with Precision, Calibration

Count the correct diagonal
Count the correct diagonalSix true positives and nine true negatives give 15 correct predictions among 20 cases. Accuracy is 15/20 = 75%.Actual / predictedPositiveNegativePositive6 TP2 FNNegative3 FP9 TN
Six true positives and nine true negatives give 15 correct predictions among 20 cases. Accuracy is 15/20 = 75%.

Precision

Of the cases the model flagged, the share that were right.

Answers
When the model raises an alert, how often is it worth acting on?
Watch out
High precision can be bought by flagging very little, missing most real cases.
Think of it as
A fishing net with a coarse mesh: almost everything you land is a keeper, but many fish swim through.
Precise definition

In classification and retrieval, precision is the fraction of predicted positive or retrieved items that are truly positive or relevant, calculated as TP / (TP + FP). In other statistical contexts, precision can mean low estimation uncertainty or, for a normal distribution, the reciprocal of variance.

Often confused with Recall, Accuracy

Try the threshold slider ↗

Look down the predicted-positive column
Look down the predicted-positive columnOf nine items the model flagged, six are true positives. Precision is 6/(6 + 3) ≈ 0.667.Actual / predictedPositiveNegativePositive6 TP2 FNNegative3 FP9 TN
Of nine items the model flagged, six are true positives. Precision is 6/(6 + 3) ≈ 0.667.

Recall

Of the real cases, the share the model caught.

Answers
What fraction of the fraud, churners, or defects are we actually catching?
Watch out
Recall of 100% is easy (flag everything); it only means something alongside precision.
Think of it as
A fishing net with a fine mesh: you catch nearly every fish, along with a lot of seaweed.
Precise definition

Recall is the fraction of actual positives that a classifier identifies, calculated as TP / (TP + FN), and is also called sensitivity. In information retrieval, it is the fraction of relevant items retrieved, so measuring it requires a sufficiently complete account of which items are relevant.

Often confused with Precision, Specificity

Try the threshold slider ↗

Look across the actual-positive row
Look across the actual-positive rowThe model found six of the eight positives. Recall is 6/(6 + 2) = 0.75.Actual / predictedPositiveNegativePositive6 TP2 FNNegative3 FP9 TN
The model found six of the eight positives. Recall is 6/(6 + 2) = 0.75.

Specificity

Of the cases that were truly negative, the share the model correctly left alone.

Answers
How good is the model at not bothering legitimate customers?
Watch out
When negatives vastly outnumber positives, even 99% specificity produces many false alarms.
Precise definition

Specificity is the fraction of actual negatives that a classifier correctly identifies as negative, calculated as TN / (TN + FP), and is also called the true-negative rate. It equals one minus the false-positive rate, and it trades off against recall as the classification threshold moves.

Often confused with Recall

Try the threshold slider ↗

Look across the actual-negative row
Look across the actual-negative rowThe model correctly cleared nine of the twelve actual negatives. Specificity is 9/(9 + 3) = 0.75, so the false-positive rate is 0.25.Actual / predictedPositiveNegativePositive6 TP2 FNNegative3 FP9 TN
The model correctly cleared nine of the twelve actual negatives. Specificity is 9/(9 + 3) = 0.75, so the false-positive rate is 0.25.

F1 Score

One number combining precision and recall, high only when both are high.

Answers
How does the model do overall on the rare class we care about?
Watch out
It weights precision and recall equally by convention, which says nothing about what false alarms and misses cost your business, and it ignores true negatives.
Precise definition

The F1 score is the harmonic mean of precision and recall, calculated as 2PR / (P + R) when the denominator is nonzero. It emphasizes achieving both precision and recall, but ignores true negatives and depends on the classification threshold and any averaging convention used across classes.

See also Recall

Try the threshold slider ↗

Combine precision and recall
Combine precision and recallWith 6 TP, 3 FP, and 2 FN, F1 = 2TP/(2TP + FP + FN) = 12/17 ≈ 0.706.PrecisionRecallF16/9 ≈ 0.6676/8 = 0.75012/17 ≈ 0.706
With 6 TP, 3 FP, and 2 FN, F1 = 2TP/(2TP + FP + FN) = 12/17 ≈ 0.706.

ROC Curve

A chart of the trade-off between catching more real cases and raising more false alarms as the cutoff moves.

Answers
Where should we set the threshold, and what do we give up either way?
Watch out
With rare positives it can look excellent while most alerts are still false; check precision too.
Precise definition

A receiver operating characteristic (ROC) curve plots a classifier's true-positive rate (recall) against its false-positive rate at every possible threshold. Each point is one threshold: moving along the curve trades more detections for more false alarms, a curve nearer the top-left corner indicates better separation, and the diagonal corresponds to random guessing.

Often confused with Area Under the Curve (AUC) · See also Recall

Try the threshold slider ↗

Every threshold is a point on the curve
Every threshold is a point on the curveEach point is one threshold on the same model. Lowering the threshold from 0.6 to 0.4 raises the true-positive rate from 63% to 95%, but false alarms climb from 5% to 37%. The area under this curve is 0.92. 0.00 0.25 0.50 0.75 1.00 False-positive rate (false alarms) 0.0 0.5 1.0 True-positive rate threshold 0.6 threshold 0.5 threshold 0.4 Classifier Random guessing
Each point is one threshold on the same model. Lowering the threshold from 0.6 to 0.4 raises the true-positive rate from 63% to 95%, but false alarms climb from 5% to 37%. The area under this curve is 0.92.

Area Under the Curve (AUC)

A single score from 0 to 1 for how well a model ranks positives above negatives: 0.5 is guessing, 1 is perfect, and below 0.5 is worse than guessing.

Answers
How good is the model at separating the two classes, regardless of where we set the cutoff?
Watch out
It says nothing about whether the predicted probabilities are accurate, nor which threshold to use.
Precise definition

AUC summarizes the area beneath a specified curve, most commonly the receiver operating characteristic curve, which plots recall against the false-positive rate across classification thresholds. ROC AUC measures ranking ability, with 0.5 representing chance-level ranking and 1 representing perfect ranking; precision–recall AUC is a different measure whose baseline depends on class prevalence.

Often confused with ROC Curve · See also Recall

Trace the ROC across score thresholds
Trace the ROC across score thresholdsIn descending score order the labels are positive, negative, positive, negative. The ROC area is 0.75 because positives outrank negatives in three of four pairs. 0.00 0.25 0.50 0.75 1.00 False-positive rate 0.0 0.5 1.0 True-positive rate Classifier Chance
In descending score order the labels are positive, negative, positive, negative. The ROC area is 0.75 because positives outrank negatives in three of four pairs.

Calibration

Whether predicted probabilities match reality: of the cases given 70%, about 70% should happen.

Answers
Can we take the model's probabilities at face value when pricing or planning?
Watch out
A model can rank cases well and still be badly over- or under-confident.
Think of it as
A weather forecaster whose "70% chance of rain" days turn out rainy seven times in ten.
Precise definition

Calibration describes agreement between predicted probabilities and observed outcome frequencies. For example, among many comparable events assigned a 70% probability, roughly 70% should occur if the predictions are calibrated; good ranking or accuracy alone does not guarantee this property.

Often confused with Accuracy

Check the predicted probabilities against frequencies
Check the predicted probabilities against frequenciesIn the highest bin the model predicts 0.80 on average, while only 65% are positive. The gap below the diagonal indicates overconfidence there. 0.0 0.2 0.4 0.6 0.8 1.0 Mean predicted probability 0.00 0.25 0.50 0.75 1.00 Observed positive share Perfect calibration Observed bins
In the highest bin the model predicts 0.80 on average, while only 65% are positive. The gap below the diagonal indicates overconfidence there.

Mean Absolute Error (MAE)

The average size of the prediction errors, ignoring direction.

Answers
On average, how many units off is the forecast?
Watch out
It treats one error of 10 the same as ten errors of 1, which may not match the business cost.
Precise definition

Mean absolute error averages the absolute differences between predicted and observed values, in the same units as the outcome. Every unit of error counts equally, so it is less dominated by a few large misses than root mean square error, and it is minimized by predicting the median rather than the mean.

Often confused with Root Mean Square Error

Drop the sign, then average
Drop the sign, then averageDropping the signs gives absolute errors of 1, 2, and 3 g. Their mean is 6/3 = 2 g, slightly below the RMSE of 2.16 g for the same errors.CaseABCError (g)−1+2−3Absolute (g)123
Dropping the signs gives absolute errors of 1, 2, and 3 g. Their mean is 6/3 = 2 g, slightly below the RMSE of 2.16 g for the same errors.

Mean Squared Error

The average of the squared prediction errors.

Answers
How far off are the predictions, with big misses counted heavily?
Watch out
It is in squared units, so it is hard to interpret directly; take the square root to get RMSE.
Precise definition

Mean squared error averages squared differences between predicted and observed values, giving larger errors greater weight. Its units are the outcome's units squared; in estimation theory, MSE instead commonly describes an estimator's expected squared deviation from the true parameter.

Often confused with Root Mean Square Error

Square each error and average
Square each error and averageThe three squared errors sum to 14 g². Their mean is 14/3 ≈ 4.67 g².CaseABCError (g)−1+2−3Squared (g²)149
The three squared errors sum to 14 g². Their mean is 14/3 ≈ 4.67 g².

Root Mean Square Error

The typical size of a prediction error, in the outcome's own units, with large misses weighted more.

Answers
Roughly how far off is a typical forecast?
Watch out
A few large errors can dominate it; compare with MAE to see whether that is happening.
Precise definition

Root mean square error, or RMSE, is the square root of the average squared prediction error. It is expressed in the same units as the outcome and gives larger errors more influence than a measure based on absolute errors.

Often confused with Mean Squared Error, Mean Absolute Error (MAE)

Return squared error to grams
Return squared error to gramsFor errors of −1, +2, and −3 g, the mean squared error is 14/3 g². Its square root is approximately 2.16 g.Errors squared1, 4, 9 g²Average4.67 g²Square root2.16 g
For errors of −1, +2, and −3 g, the mean squared error is 14/3 g². Its square root is approximately 2.16 g.

Mean Absolute Percentage Error (MAPE)

The average prediction error expressed as a percentage of the actual value.

Answers
How far off are the forecasts in percentage terms, across products of different sizes?
Watch out
It explodes for low-volume items and cannot handle actual values of zero.
Precise definition

Mean absolute percentage error averages each absolute error as a percentage of the actual value, giving a unit-free figure that is easy to compare across products or regions. It is undefined when an actual value is zero, is inflated by small actual values, and treats the two directions unevenly: for a nonnegative forecast an under-forecast can never score worse than 100%, while an over-forecast is unbounded. A miss of the same absolute size also counts for more when the actual value is smaller.

Small actuals inflate percentage errors
Small actuals inflate percentage errorsThe three percentage errors average (10 + 10 + 50)/3 ≈ 23%. Product C misses by only 5 units, yet its small actual value makes it dominate the result.ProductActualForecastErrorA10011010%B504510%C101550%
The three percentage errors average (10 + 10 + 50)/3 ≈ 23%. Product C misses by only 5 units, yet its small actual value makes it dominate the result.

Predictive algorithms and ensembles

9 terms
Terms in this topic

Decision Trees

A model that makes predictions by following a flowchart of yes/no questions.

Answers
What simple rules separate the outcomes?
Watch out
A single deep tree is easy to read but unstable: small changes in the data can redraw it completely.
Think of it as
A game of Twenty Questions that ends in a prediction.
Precise definition

Decision trees make predictions by repeatedly splitting observations according to feature-based rules and assigning an output at each terminal node. They can handle classification or regression, but unrestricted trees can fit noise and change substantially after small changes in the training data.

Follow a split to a prediction
Follow a split to a predictionThis one-split regression tree assigns a mean cycle time of 8 s to loads ≤ 5 and 14 s to greater loads.Load ≤ 5?Yes: 8 sNo: 14 s
This one-split regression tree assigns a mean cycle time of 8 s to loads ≤ 5 and 14 s to greater loads.

k-Nearest Neighbors (k-NN)

Predicting by looking up the most similar past cases and going with what happened to them.

Answers
What happened to customers most like this one?
Watch out
"Similar" depends entirely on which features are used and how they are scaled.
Think of it as
Asking the three most similar neighbors what they did.
Precise definition

k-nearest neighbors predicts the outcome for a new case from the k most similar cases in the training data, by majority vote for classification or by averaging for numerical outcomes. It has no training step beyond storing the data, depends heavily on feature scaling and the choice of k, and slows down as the stored dataset grows.

Often confused with K-means Clustering

Let the three nearest neighbors vote
Let the three nearest neighbors voteThe three stored points closest to the star are two of class A and one of class B, so with k = 3 the vote assigns class A. A different k, or different feature scaling, could change the answer. 1.0 1.5 2.0 2.5 3.0 3.5 4.0 Feature 1 0.5 1.0 1.5 2.0 2.5 3.0 3.5 Feature 2 Class A Class B New case
The three stored points closest to the star are two of class A and one of class B, so with k = 3 the vote assigns class A. A different k, or different feature scaling, could change the answer.

Naive Bayes Classifier

A fast, simple classifier that treats each piece of evidence as independent of the others once the class is known.

Answers
Can we get a quick, reasonable classifier for text such as spam or ticket routing?
Watch out
Its probability outputs tend to be too extreme, even when its classifications are good.
Precise definition

A naive Bayes classifier applies Bayes' theorem with the simplifying assumption that features are conditionally independent given the class. This assumption is often imperfect, yet the resulting models can be efficient and useful, especially for tasks such as text classification.

See also Bayes' Theorem

Combine the evidence within each class
Combine the evidence within each classFor two observed features, multiply the class prior by both conditional probabilities. The larger score favors class A under conditional independence.ClassPriorP(f₁|class)P(f₂|class)ScoreA.50.80.60.24B.50.30.40.06
For two observed features, multiply the class prior by both conditional probabilities. The larger score favors class A under conditional independence.

Support Vector Machines (SVMs)

A classifier that draws the boundary leaving the widest possible gap between the classes.

Answers
How do we separate two groups as cleanly as possible?
Watch out
It is sensitive to feature scaling and does not naturally produce probabilities.
Precise definition

Support vector machines fit decision boundaries by balancing a wide separating margin against penalties for violations or classification errors. Kernel functions allow nonlinear boundaries without explicitly constructing all transformed features, and related support vector regression methods predict numerical outcomes.

Find a wide separating margin
Find a wide separating marginThe solid vertical line separates the classes. The two circled support vectors touch the dotted margins and determine this boundary. -1.5 0.0 1.5 Feature 1 0.0 0.8 1.6 2.4 Feature 2 Class A Class B
The solid vertical line separates the classes. The two circled support vectors touch the dotted margins and determine this boundary.

Ensemble Methods

Combining several models to get better predictions than any one alone.

Answers
Can several imperfect models together outperform the best single one?
Watch out
The gain comes from models making different mistakes; combining near-copies adds little.
Think of it as
The wisdom of crowds, which works only when the crowd does not all think alike.
Precise definition

Ensemble methods combine predictions from several models to improve performance or stability. Common approaches include bagging, boosting, and stacking, and their benefit depends partly on how the component models' errors differ.

See also Boosting, Bagging

Take a majority vote
Take a majority voteThree classifiers vote on the same case. Two votes for “pass” give the ensemble’s predicted label.ModelABCVotePassFlagPass
Three classifiers vote on the same case. Two votes for “pass” give the ensemble’s predicted label.

Bagging

Training many models on random resamples of the data and averaging their predictions.

Answers
How do we make an unstable model more reliable?
Watch out
It steadies predictions but does not fix a model that is systematically wrong.
Think of it as
Polling many independent experts and taking the average.
Precise definition

Bagging, short for bootstrap aggregating, fits multiple models to bootstrap samples of the training data and combines their predictions. Averaging or voting can reduce prediction variance, particularly for unstable models such as deep decision trees.

Often confused with Boosting · See also Decision Trees

Average predictions across resampled fits
Average predictions across resampled fitsThree trees fit to different bootstrap samples predict 14, 16, and 15 g. Averaging gives 15 g.Train rowsResample 1: 14Resample 2: 16Resample 3: 15Mean = 15
Three trees fit to different bootstrap samples predict 14, 16, and 15 g. Averaging gives 15 g.

Random Forest

Many decision trees, each built on a different random slice of the data, voting together.

Answers
What is a strong, low-maintenance model for tabular business data?
Watch out
It is accurate but hard to explain, and it cannot predict beyond the range of values it has seen.
Think of it as
A committee of specialists who each studied different files and then vote.
Precise definition

A random forest combines many decision trees, typically trained using bootstrap samples and random subsets of candidate features at each split. This randomness helps reduce correlation between trees, making their combined predictions more stable than those of a single tree.

See also Decision Trees

Vary both the sample and the split candidates
Vary both the sample and the split candidatesEach tree fits a bootstrap sample and considers a randomly chosen feature subset at a split. For this case the vote is two “pass” predictions to one.TreeSampleRoot candidatesVote1Bootstrap ALight, agePass2Bootstrap BAge, tempFlag3Bootstrap CLight, tempPass
Each tree fits a bootstrap sample and considers a randomly chosen feature subset at a split. For this case the vote is two “pass” predictions to one.

Boosting

Building models in sequence, each concentrating on what the previous ones got wrong.

Answers
How do we squeeze more accuracy out of simple models?
Watch out
It can overfit noisy data if run too long without checks.
Think of it as
A tutor who drills you on exactly the questions you keep missing.
Precise definition

Boosting constructs an ensemble sequentially, with later models addressing aspects of the objective that earlier models handle poorly. AdaBoost changes observation weights, while gradient boosting adds models that follow the loss function's negative gradient, so boosting is a family of methods rather than one weighting rule.

Often confused with Bagging, Gradient Boosting · See also Loss Function

Add corrections in sequence
Add corrections in sequenceAt one example input, the first prediction is 10. Two later learners contribute +3 and −1, producing a boosted prediction of 12.Start10Add +313Add −112
At one example input, the first prediction is 10. Two later learners contribute +3 and −1, producing a boosted prediction of 12.

Gradient Boosting

A top-performing method for tabular data that adds many small models, usually decision trees, each one reducing the error left by those before it.

Answers
What is likely to be the most accurate model for our spreadsheet-style data?
Watch out
It needs careful tuning and is harder to explain than a single tree or a regression.
Precise definition

Gradient boosting builds a prediction model as a sum of many simple models, usually small decision trees, added one at a time. Each is fitted to the negative gradient of the loss at the current predictions, which for squared error is simply the residual errors, and is scaled by a learning rate. Implementations such as XGBoost and LightGBM are among the strongest methods for tabular data, but the number of trees, tree depth, and learning rate need tuning to avoid overfitting.

Often confused with Boosting · See also Decision Trees, Learning Rate, Overfitting

Small trees added one correction at a time
Small trees added one correction at a timeWith squared-error loss, each tree is a single split fitted to the residual errors left so far, added at a learning rate of 0.3. Training error (RMSE) falls from 2.3 after 1 tree to 1.3 after 5 and 0.4 after 50, as the steps trace the curve. 0 1 2 3 4 5 6 Input 6 8 10 12 14 Outcome Training data 1 tree 5 trees 50 trees
With squared-error loss, each tree is a single split fitted to the residual errors left so far, added at a learning rate of 0.3. Training error (RMSE) falls from 2.3 after 1 tree to 1.3 after 5 and 0.4 after 50, as the steps trace the curve.

Clustering, representations, and similarity

14 terms
Terms in this topic

Euclidean Distance

Straight-line distance between two points.

Answers
How far apart are two cases across several measurements?
Watch out
Features with large numbers dominate unless the data are scaled first.
Precise definition

Euclidean distance is the straight-line distance between two numerical vectors, calculated as the square root of the sum of squared coordinate differences. Features with larger numerical scales can dominate it, so scaling and feature relevance matter when using it for clustering or neighbor search.

Often confused with Manhattan Distance · See also Clustering

Measure the diagonal
Measure the diagonalFrom (0,0) to (3,4), the green straight-line distance is √(3² + 4²) = 5. 0 1 2 3 Coordinate x 0 1 2 3 4 Coordinate y
From (0,0) to (3,4), the green straight-line distance is √(3² + 4²) = 5.

Manhattan Distance

Distance measured along a grid: the sum of the absolute differences on each dimension.

Answers
How far apart are two cases if we add up the size of the difference on each feature?
Watch out
Like other distances, it is dominated by whichever feature has the largest scale.
Precise definition

Manhattan distance is the sum of the absolute coordinate differences between two vectors, also called L1 distance. It corresponds to travel along axis-aligned paths and, like Euclidean distance, depends on how the features are scaled.

Often confused with Euclidean Distance

Follow the coordinate axes
Follow the coordinate axesFrom (0,0) to (3,4), the orange route covers 3 horizontal units plus 4 vertical units. Its Manhattan distance is 7. 0 1 2 3 Coordinate x 0 1 2 3 4 Coordinate y
From (0,0) to (3,4), the orange route covers 3 horizontal units plus 4 vertical units. Its Manhattan distance is 7.

Cosine Similarity

A measure of whether two vectors point in the same direction, ignoring their length.

Answers
How alike are two documents or customer profiles in pattern, regardless of size?
Watch out
It ignores magnitude, so a heavy user and a light user with the same mix look identical.
Precise definition

Cosine similarity is the dot product of two nonzero vectors divided by the product of their lengths. It measures alignment rather than magnitude, making it useful for comparing text embeddings even when their vector lengths differ.

See also Embedding

Compare the angle between two vectors
Compare the angle between two vectorsThe vectors (1,0) and (1,1) form a 45° angle. Their cosine similarity is 1/√2 ≈ 0.707. 0.0 0.3 0.6 0.9 1.2 Coordinate 1 0.0 0.4 0.8 1.2 Coordinate 2
The vectors (1,0) and (1,1) form a 45° angle. Their cosine similarity is 1/√2 ≈ 0.707.

Jaccard Similarity

The overlap between two sets: shared items divided by all distinct items.

Answers
How similar are two customers' baskets or two documents' keywords?
Watch out
It ignores how often items occur; buying something once or fifty times counts the same.
Precise definition

Jaccard similarity measures the overlap of two sets as the size of their intersection divided by the size of their union. It is useful for comparing sets of words or attributes, with a separate convention needed when both sets are empty.

Compare shared and distinct tokens
Compare shared and distinct tokensThe sets {leaf, bed, light} and {bed, light, pump} share two of their four distinct terms. Jaccard similarity is 2/4 = 0.50.Set Aleafbedlight—Set B—bedlightpump
The sets {leaf, bed, light} and {bed, light, pump} share two of their four distinct terms. Jaccard similarity is 2/4 = 0.50.

Hamming Distance

The number of positions at which two equal-length sequences differ.

Answers
How many fields or characters differ between two records or codes?
Watch out
It only works for equal-length sequences and counts every mismatch as equally important.
Precise definition

Hamming distance counts the positions at which two equal-length sequences differ. It is useful for binary codes and categorical sequences, while some implementations report the proportion of differing positions instead of the count.

Count different positions
Count different positionsThe two five-bit strings differ at positions 2 and 4. Their Hamming distance is 2.String A10101String B11111
The two five-bit strings differ at positions 2 and 4. Their Hamming distance is 2.

Clustering

Grouping similar items together without predefined labels.

Answers
Are there natural segments among our customers or products?
Watch out
Many algorithms, such as k-means with a chosen number of groups, return groups whether or not meaningful ones exist.
Precise definition

Clustering groups observations according to a chosen notion of similarity without requiring supplied group labels. Different algorithms can produce different valid groupings, so clusters should be judged against the data structure and the intended use rather than treated as automatically existing natural categories.

Often confused with Classification

Group nearby observations
Group nearby observationsAn illustrative two-cluster assignment groups observations by their standardized feature positions. Shape and color indicate membership. 0.8 1.6 2.4 3.2 Scaled light 0.6 1.2 1.8 2.4 Scaled yield
An illustrative two-cluster assignment groups observations by their standardized feature positions. Shape and color indicate membership.

K-means Clustering

A method that splits data into a chosen number of groups around central points.

Answers
If we want five customer segments, what are they?
Watch out
You must choose the number of groups yourself, and results shift with scaling and the random start.
Precise definition

K-means clustering partitions observations into a chosen number k of groups by minimizing squared Euclidean distances to cluster centroids. It is sensitive to scaling, initialization, and outliers, and tends to work best when clusters are reasonably compact under that distance measure.

Often confused with k-Nearest Neighbors (k-NN) · See also Euclidean Distance, Clustering, Outlier

A centroid is the mean of its members
A centroid is the mean of its membersEach X marks the arithmetic mean of its assigned cluster. K-means assigns points by squared Euclidean distance and updates these means. 0.8 1.6 2.4 3.2 Feature 1 0.6 1.2 1.8 2.4 Feature 2
Each X marks the arithmetic mean of its assigned cluster. K-means assigns points by squared Euclidean distance and updates these means.

Hierarchical Clustering

Clustering that builds a tree of groups within groups.

Answers
How do our segments nest, from broad groups down to fine ones?
Watch out
Where you cut the tree, and so how many clusters you get, is a judgment call.
Precise definition

Hierarchical clustering creates a nested grouping of observations, usually by repeatedly merging clusters or splitting a larger cluster. The resulting dendrogram displays the hierarchy, and the distance measure and linkage rule determine what kinds of groups emerge.

See also Clustering

Read the merges from the leaves upward
Read the merges from the leaves upwardSingle linkage first joins A and B at distance 1, then C and D at 2, and finally the two clusters at 3. A B C D Item 0 1 2 3 Merge distance
Single linkage first joins A and B at distance 1, then C and D at 2, and finally the two clusters at 3.

Anomaly Detection

Automatically flagging cases that look unlike the rest.

Answers
Which transactions, readings, or accounts deserve a closer look?
Watch out
Unusual is not the same as bad; many anomalies are harmless, and many problems look normal.
Precise definition

Anomaly detection identifies observations or patterns that depart from expected behavior. An unusual sensor reading or robot cycle time may indicate an error, a fault, or a meaningful rare event, so an anomaly is not automatically a bad data point.

Often confused with Outlier

Find an unusual combination of readings
Find an unusual combination of readingsThe orange diamond falls away from the dense group of usual operating points in this two-sensor example. -0.8 0.0 0.8 1.6 Temperature deviation -0.6 0.0 0.6 1.2 Vibration deviation
The orange diamond falls away from the dense group of usual operating points in this two-sensor example.

Principal Component Analysis (PCA)

A way of compressing many correlated measurements into a few summary dimensions.

Answers
Can we reduce fifty related metrics to a handful that capture most of the variation?
Watch out
The components are blends of the original variables and can be hard to name or explain.
Think of it as
The most informative shadow of a three-dimensional object.
Precise definition

PCA constructs orthogonal linear combinations of centered features that successively capture the greatest remaining variance. It can reduce dimensionality, but high-variance directions are not necessarily the most predictive, and feature scaling strongly affects the result.

See also Variance

Find the direction of greatest spread
Find the direction of greatest spreadThe orange line is the first principal component of the centered cloud. Projecting a point onto it gives a one-dimensional score. -2 -1 0 1 2 Centered feature 1 -1 0 1 2 Centered feature 2
The orange line is the first principal component of the centered cloud. Projecting a point onto it gives a one-dimensional score.

Matrix Factorization

Breaking a large table into smaller pieces that capture its main patterns.

Answers
What hidden tastes or themes explain which customers buy which products?
Watch out
The discovered factors are mathematical conveniences and may not correspond to anything nameable.
Precise definition

Matrix factorization expresses a matrix as a product of simpler matrices, exactly or approximately. Methods such as singular value decomposition can reveal lower-dimensional structure and support dimensionality reduction, compression, and recommendation systems.

Build a rank-one table from two factors
Build a rank-one table from two factorsThe outer product of [1, 2, 3] and [2, 4] reconstructs every cell. Row factor 3 times column factor 4 gives 12.Row factorColumn factor 2Column factor 41242483612
The outer product of [1, 2, 3] and [2, 4] reconstructs every cell. Row factor 3 times column factor 4 gives 12.

Dense Vector

A list of numbers, mostly nonzero, that represents an item compactly.

Answers
How is a text or image stored so that a model can compare it with others?
Watch out
"Dense" only means most entries are nonzero. In learned embeddings the individual numbers usually have no readable meaning on their own.
Precise definition

A dense vector is a numerical representation in which most components are nonzero, in contrast to a sparse vector with many zeros. Learned embeddings are commonly dense, and their individual coordinates usually do not have simple, separately named meanings.

See also Embedding

Read one value per coordinate
Read one value per coordinateThis five-dimensional embedding has a nonzero value in every position. The sign and magnitude of each coordinate are shown separately. v₁ v₂ v₃ v₄ v₅ -0.4 0.0 0.4 0.8 Coordinate value
This five-dimensional embedding has a nonzero value in every position. The sign and magnitude of each coordinate are shown separately.

Embedding

A list of numbers representing the meaning of a word, document, or image, so that similar items get similar numbers.

Answers
How can software tell that two differently worded texts mean the same thing?
Watch out
"Similar" reflects what the model was trained on, which may not match your idea of similar.
Think of it as
Map coordinates for meaning: related things end up close together.
Precise definition

An embedding maps an item such as a word, passage, image, or entity into a numerical vector intended to capture useful relationships. Similarity between embeddings can support retrieval or clustering, but what counts as similar depends on the model's training and the comparison measure.

Often confused with Token · See also Clustering

A toy two-dimensional word space
A toy two-dimensional word spacePlant terms appear near one another, as do equipment terms. Coordinates here are illustrative and represent no specific trained embedding model. 0.0 0.8 1.6 2.4 3.2 Coordinate 1 0.6 1.2 1.8 Coordinate 2 leaf lettuce pump valve
Plant terms appear near one another, as do equipment terms. Coordinates here are illustrative and represent no specific trained embedding model.

Neural networks and architectures

16 terms
Terms in this topic

Perceptron

The simplest artificial neuron: a weighted sum of inputs followed by a yes/no threshold.

Answers
What is the basic building block of a neural network?
Watch out
A single one can only separate classes with a straight line.
Precise definition

A classical perceptron is a simple binary classifier that applies a threshold to a weighted sum of inputs plus a bias. A single perceptron can represent only a linear decision boundary, whereas multilayer networks with nonlinear activations can represent more complex relationships.

Threshold a weighted sum
Threshold a weighted sumWith weights (2, −1), bias −1, and input (2,1), the weighted sum is 2. A threshold at zero produces class 1.Input(2, 1)2×2 − 1 − 1Score = 2Score ≥ 0Class 1
With weights (2, −1), bias −1, and input (2,1), the weighted sum is 2. A threshold at zero produces class 1.

Artificial Neural Network (ANN)

A model built from layers of simple connected units that learns patterns by adjusting the connection strengths.

Answers
How can we model complicated relationships in images, text, or large datasets?
Watch out
The resemblance to the brain is loose; these are mathematical functions, not thinking machines.
Precise definition

An artificial neural network is a model composed of connected computational units organized into layers. Training adjusts its weights and biases so that the network learns useful mappings, such as converting sensor measurements into a predicted harvest weight.

A fully connected 2–3–1 network
A fully connected 2–3–1 networkEach of the three hidden units receives both input features. The output combines all three hidden activations into one prediction.12Inputs123Hidden units1Output
Each of the three hidden units receives both input features. The output combines all three hidden activations into one prediction.

Activation Function

The step in each artificial neuron that decides how strongly it responds to its input.

Answers
What lets a neural network learn curves and thresholds rather than just straight lines?
Watch out
Without these nonlinear steps, a deep network is no more capable than a single linear model.
Precise definition

An activation function transforms a neuron's input into its output, usually after a weighted sum and an added bias. Nonlinear activations such as ReLU, sigmoid, and tanh allow a neural network to learn relationships that a stack of purely linear transformations cannot represent.

Same input, different response
Same input, different responseA unit can keep positive inputs and suppress negative ones with ReLU, or smoothly saturate in both directions with tanh. -4 -2 0 2 4 Weighted input 0.0 1.5 3.0 Activation ReLU tanh
A unit can keep positive inputs and suppress negative ones with ReLU, or smoothly saturate in both directions with tanh.

ReLU Function (Rectified Linear Unit)

A simple rule used inside neural networks: pass positive values through, turn negatives into zero.

Answers
What is the default "switch" inside modern neural networks?
Watch out
Units that fall permanently into the zero zone stop learning.
Precise definition

ReLU is the activation function f(x) = max(0, x), which returns zero for negative inputs and leaves positive inputs unchanged. Its simple derivative helps gradient-based training, although units that remain in the negative-input region can stop receiving useful gradient updates.

See also Activation Function

Clip the negative half of the input
Clip the negative half of the inputAt input −2, ReLU outputs 0. At input +2 it outputs 2, giving a flat left branch and a right branch of slope 1. -4 -2 0 2 4 Input x 0.0 1.5 3.0 max(0, x)
At input −2, ReLU outputs 0. At input +2 it outputs 2, giving a flat left branch and a right branch of slope 1.

Sigmoid Function

An S-shaped curve that squashes any number into the range 0 to 1.

Answers
How is a raw model score turned into a probability?
Watch out
An output between 0 and 1 is not automatically a trustworthy probability.
Precise definition

The logistic sigmoid is the S-shaped function σ(x) = 1 / (1 + exp(−x)), mapping any finite real input into the interval between 0 and 1. It converts log-odds into probabilities in logistic regression, but its small derivatives at extreme inputs can slow neural-network learning.

See also Logistic Regression

Convert log-odds to a probability
Convert log-odds to a probabilityZero log-odds gives probability 0.50. Moving from 0 toward either extreme gradually flattens the response. -4 -2 0 2 4 Log-odds 0.0 0.3 0.6 0.9 Probability
Zero log-odds gives probability 0.50. Moving from 0 toward either extreme gradually flattens the response.

Tanh Function

An S-shaped curve that squashes any number into the range −1 to 1.

Answers
What activation gives outputs centered on zero?
Watch out
Like the sigmoid, it flattens at the extremes, which slows learning in deep networks.
Precise definition

The hyperbolic tangent, tanh, is a smooth S-shaped activation that maps real inputs to values between −1 and 1. Its output is centered around zero, but its derivative becomes small for large positive or negative inputs, which can contribute to vanishing gradients.

See also Vanishing Gradient

A smooth response from −1 to +1
A smooth response from −1 to +1The output crosses zero at x = 0. At x = 2 it is about 0.964, close to the positive saturation level. -4 -2 0 2 4 Input x −1.0 −0.5 0.0 0.5 1.0 tanh(x)
The output crosses zero at x = 0. At x = 2 it is about 0.964, close to the positive saturation level.

Softmax Function

A formula that turns a set of scores into probabilities that add up to 100%.

Answers
How does a model spread its confidence across several possible answers?
Watch out
The outputs always sum to one, which can make a model look confident even on inputs it has never seen.
Precise definition

Softmax transforms a vector of real-valued scores into positive values that sum to one by exponentiating each score and dividing by the sum of exponentials. It is commonly used to represent mutually exclusive class probabilities, but normalized outputs are not automatically well-calibrated probabilities.

Try the temperature dial ↗

Divide exponentials by their sum
Divide exponentials by their sumFor logits 0, 1, and 2, softmax converts exponentials into class probabilities. The displayed probabilities sum to 1.000.ClassLogitExponentialProbabilityA01.000.090B12.720.245C27.390.665
For logits 0, 1, and 2, softmax converts exponentials into class probabilities. The displayed probabilities sum to 1.000.

Convolutional Neural Network (CNN)

A neural network that scans an input with small reusable pattern detectors; the standard design for images.

Answers
How can software recognize objects, defects, or text in images?
Watch out
It needs many labeled examples and can fail on images unlike those it was trained on.
Think of it as
Sliding a small stencil across a picture to find where a pattern appears.
Precise definition

A convolutional neural network applies learned filters across local regions of an input, reusing the same filter weights across positions. This structure is useful for detecting spatial or sequential patterns, such as leaf edges in images or local changes in sensor signals.

Reuse one filter at successive positions
Reuse one filter at successive positionsSliding the filter [−1, +1] across [1, 3, 2, 6] produces the local differences [2, −1, 4]. The same weights are used at all three positions.Signal1326Filter−1+1Feature map+2−1+4
Sliding the filter [−1, +1] across [1, 3, 2, 6] produces the local differences [2, −1, 4]. The same weights are used at all three positions.

Pooling

Shrinking data by summarizing each small region with one number; in statistics, sharing information across groups.

Answers
How does a network cut down the detail it must process? Or: how do small groups borrow strength from the whole?
Watch out
The two meanings are unrelated; check whether the context is neural networks or statistics.
Precise definition

In convolutional networks, pooling summarizes a region using an operation such as its maximum or average, reducing representation size. In statistical modeling, pooling instead refers to sharing information across groups, with partial pooling balancing group-specific estimates against a common pattern.

Summarize two local windows
Summarize two local windowsMax pooling with width 2 and stride 2 keeps the largest value from each adjacent pair. The length falls from four values to two.WindowInputsPooled output11, 4423, 23
Max pooling with width 2 and stride 2 keeps the largest value from each adjacent pair. The length falls from four values to two.

Object Detection

Finding and labeling each object in an image with a box around it.

Answers
Where are the items in this picture, and how many are there?
Watch out
It is a harder and more data-hungry task than deciding what the whole image shows.
Precise definition

Object detection identifies objects in an image or video and estimates their locations, commonly with bounding boxes. It combines classification with localization and differs from image classification, which can assign a label without locating individual objects.

Locate each individual plant
Locate each individual plantThe two bounding boxes carry the same class label, “lettuce.” Each box also gives the location and extent of a separate object.lettucelettuce
The two bounding boxes carry the same class label, “lettuce.” Each box also gives the location and extent of a separate object.

Recurrent Neural Network (RNN)

A neural network that reads a sequence one step at a time, carrying a running summary forward.

Answers
How can a model handle data where order matters, such as text or sensor readings?
Watch out
Basic versions forget early inputs quickly.
Precise definition

A recurrent neural network processes sequences by updating a hidden state using the current input and the preceding state. Reusing parameters across steps allows it to model sequential dependence, but basic RNNs can struggle to learn long-range relationships.

Carry state through a sequence
Carry state through a sequenceThe same recurrent unit updates its hidden state for each word. A later state can therefore encode information from earlier words.“pump”Input → h₁“ran”h₁ + input → h₂“today”h₂ + input → h₃
The same recurrent unit updates its hidden state for each word. A later state can therefore encode information from earlier words.

Long Short-Term Memory (LSTM)

A sequence model with a memory it can choose to keep, update, or forget.

Answers
How can a model use what happened many steps ago when predicting what comes next?
Watch out
Largely superseded by transformers for language, though still used for some time-series work.
Precise definition

An LSTM is a recurrent neural network unit with a memory state and gates that control what information is retained, added, and exposed. This structure helps it learn dependencies across longer sequences than a basic recurrent network, although it does not eliminate every training difficulty.

See also Recurrent Neural Network (RNN)

A gate controls the memory update
A gate controls the memory updateFor one cell, cₜ = fₜcₜ₋₁ + iₜgₜ. With previous memory 0.8, forget gate 0.5, input gate 0.25, and candidate 0.4, the new memory is 0.50.Retained memoryNew contributionUpdated memory0.5 × 0.80.25 × 0.40.40 + 0.100.400.100.50
For one cell, cₜ = fₜcₜ₋₁ + iₜgₜ. With previous memory 0.8, forget gate 0.5, input gate 0.25, and candidate 0.4, the new memory is 0.50.

Attention

A mechanism that lets a model weigh which parts of its input matter most for each part of its output.

Answers
How does a language model work out what "it" refers to in a sentence?
Watch out
Attention weights show where the model looked, which is not a full explanation of its answer.
Think of it as
A highlighter that marks the relevant words before answering.
Precise definition

Attention computes a weighted combination of information, with weights determined by how relevant different positions or items are to a query. In a transformer, learned query, key, and value projections let a token draw context from other permitted tokens, but attention weights alone are not a complete explanation of the prediction.

See also Language Models

Weight the context for one query
Weight the context for one queryFor the query “it” in “the pump stopped because it…”, these illustrative attention weights give the word “pump” the largest weight among the four preceding tokens. Its actual contribution also depends on the value vector that the weight multiplies. the pump stopped because 0.0 0.2 0.4 0.6 Attention weight
For the query “it” in “the pump stopped because it…”, these illustrative attention weights give the word “pump” the largest weight among the four preceding tokens. Its actual contribution also depends on the value vector that the weight multiplies.

Transformer Model

The neural network design behind modern language models: attention lets every position in the input draw on the others in parallel, while generated text is still produced one token at a time.

Answers
What technology underlies today's AI chat assistants?
Watch out
The architecture gives fluency, not factual reliability; that depends on training and grounding.
Precise definition

A transformer is a neural-network architecture built around attention mechanisms and position-wise feedforward layers, usually with residual connections and normalization. Attention lets each position combine information from other permitted positions, while positional information represents order and masking controls which context is available.

See also Language Models

Two operations inside a transformer block
Two operations inside a transformer blockSelf-attention mixes information across allowed token positions. A shared feedforward network transforms each resulting position separately. The sketch omits normalization and residual paths.Token vectorswith positionsSelf-attentionmix positionsFeedforwardper position
Self-attention mixes information across allowed token positions. A shared feedforward network transforms each resulting position separately. The sketch omits normalization and residual paths.

Generative Adversarial Networks (GANs)

Two networks trained against each other: one creates fakes, the other tries to catch them.

Answers
How can a model generate realistic synthetic images or data?
Watch out
Training is hard to stabilize, and the output may cover only part of the variety in real data.
Think of it as
A forger and a detective who each improve by trying to beat the other.
Precise definition

A generative adversarial network trains a generator to produce synthetic examples and a discriminator to distinguish generated examples from real ones. Their competing objectives can produce realistic samples, but training can be unstable and the generator may fail to represent the full diversity of the data.

One discriminator sees both sources
One discriminator sees both sourcesThe generator maps noise to synthetic examples. The discriminator scores real and generated inputs, and the dashed arrow shows its gradients returning to the generator as a learning signal.learning signalNoiseGeneratorFake dataReal dataDiscriminator
The generator maps noise to synthetic examples. The discriminator scores real and generated inputs, and the dashed arrow shows its gradients returning to the generator as a learning signal.

Variational Autoencoder

A model that learns to compress data into a small set of numbers and to generate new examples from them.

Answers
How can we generate new, plausible variations of our data, or spot items that do not fit?
Watch out
Its outputs tend to be blurrier or more averaged than those of other generative methods.
Precise definition

A variational autoencoder is a probabilistic generative model with an encoder that approximates a latent-variable posterior and a decoder that models data given those latent variables. Training balances reconstruction with a penalty encouraging the approximate posterior to stay close to a chosen prior, typically through an evidence lower bound objective.

Encode a distribution and sample a latent value
Encode a distribution and sample a latent valueFor an input x, the encoder predicts a mean and spread. A sample z from that approximate posterior supplies the decoder with a latent representation for reconstruction.Input xEncoderMean μScale σDraw zDecode
For an input x, the encoder predicts a mean and spread. A sample z from that approximate posterior supplies the decoder with a latent representation for reconstruction.

Optimization, regularization, and model adaptation

16 terms
Terms in this topic

Loss Function

The formula that scores how wrong a prediction is.

Answers
How do we tell the model what counts as a mistake, and how bad each one is?
Watch out
Different loss functions punish errors differently, so the choice shapes the model's behavior.
Precise definition

A loss function assigns a numerical penalty to a prediction or model output, such as squared error for regression or cross-entropy for classification. Training seeks parameters that reduce the chosen loss, which may differ from the metric or business outcome ultimately used to judge the model.

Often confused with Cost Function · See also Cross-entropy

Compare penalties for one prediction error
Compare penalties for one prediction errorAn error of magnitude 2 incurs squared loss 4 or absolute loss 2. The fitting objective determines how strongly larger errors influence training. -2 -1 0 1 2 Prediction minus observation 0.0 1.5 3.0 Loss Squared error Absolute error
An error of magnitude 2 incurs squared loss 4 or absolute loss 2. The fitting objective determines how strongly larger errors influence training.

Cost Function

The single number a model tries to make as small as possible during training.

Answers
What exactly is the model being optimized for?
Watch out
The model optimizes this number, not your business goal; if the two differ, so will the results.
Precise definition

A cost function is an objective minimized during model fitting, often an aggregate of prediction losses plus a regularization penalty. Some sources use cost and loss interchangeably, while others reserve loss for one observation and cost for the combined training objective.

Often confused with Loss Function · See also Regularization

Combine sample losses with a penalty
Combine sample losses with a penaltyFor losses 1, 4, and 1, the mean loss is 2. Adding a regularization penalty of 0.5 gives training cost 2.5.Losses1, 4, 1Mean loss2Add penaltyCost = 2.5
For losses 1, 4, and 1, the mean loss is 2. Adding a regularization penalty of 0.5 gives training cost 2.5.

Gradient Descent

Improving a model step by step by repeatedly nudging its settings in the direction that most reduces error.

Answers
How does a model actually learn from data?
Watch out
It can settle on a good-enough solution rather than the best possible one.
Think of it as
Walking downhill in fog, feeling for the steepest slope underfoot.
Precise definition

Gradient descent minimizes a differentiable objective by repeatedly moving parameters in the direction opposite its gradient. The learning rate controls the step size, and the method generally seeks a local solution rather than guaranteeing the best possible solution for a nonconvex objective.

Often confused with Backpropagation · See also Learning Rate

Try the step-size slider ↗

Step down a quadratic loss
Step down a quadratic lossFor L(w) = w² and learning rate 0.25, each update halves w. The marked points trace w = 2, 1, 0.5, 0.25. -1.5 0.0 1.5 Parameter w 0 2 4 6 Loss
For L(w) = w² and learning rate 0.25, each update halves w. The marked points trace w = 2, 1, 0.5, 0.25.

Learning Rate

The size of each step a model takes while learning.

Answers
How fast should the model update itself from each batch of data?
Watch out
Too large and training becomes unstable; too small and it crawls or stalls.
Think of it as
Stride length when walking downhill: too long and you overshoot the valley.
Precise definition

The learning rate controls how much an optimizer changes model parameters in response to a gradient. A rate that is too large can cause unstable updates, while one that is too small can make training slow; schedules can change the rate during training.

Two step sizes on the same loss
Two step sizes on the same lossFor L(w) = w² from w = 1, a rate of 0.1 decays steadily. A rate of 0.8 crosses zero repeatedly as it approaches the minimum. 0 2 4 6 Update number -0.5 0.0 0.5 1.0 Parameter w Rate 0.1 Rate 0.8
For L(w) = w² from w = 1, a rate of 0.1 decays steadily. A rate of 0.8 crosses zero repeatedly as it approaches the minimum.

Stochastic Gradient Descent

Gradient descent that updates the model using a small random sample of the data at each step.

Answers
How can models be trained on datasets too big to process all at once?
Watch out
Each step is noisy, so training curves jitter; that is expected, not a fault.
Precise definition

Stochastic gradient descent updates parameters using gradients estimated from randomly selected training examples rather than the entire dataset at every step. Implementations commonly use small mini-batches, producing noisy but relatively inexpensive updates that can scale to large datasets.

See also Gradient Descent

Noise enters the gradient estimate
Noise enters the gradient estimateBoth paths start from the same parameter value on a quadratic objective. The simulated noisy-gradient path fluctuates around the full-gradient trajectory. 0 6 12 18 24 Update number 0.0 0.8 1.6 2.4 Parameter Full gradient Noisy gradient
Both paths start from the same parameter value on a quadratic objective. The simulated noisy-gradient path fluctuates around the full-gradient trajectory.

Batch Size

How many examples the model looks at before each update.

Answers
How is training data fed to the model?
Watch out
It affects training speed and stability, and has to be tuned together with the learning rate.
Precise definition

Batch size is the number of training examples used to compute each parameter update. Smaller batches give noisier but more frequent updates and use less memory, whereas larger batches give smoother gradient estimates and use hardware more efficiently; the best choice interacts with the learning rate.

Often confused with Epoch · See also Learning Rate

Fewer, smoother updates as batches grow
Fewer, smoother updates as batches growFor 1,000 training examples, a batch size of 100 means each update averages 100 examples and an epoch has 10 updates. A batch of all 1,000 is ordinary full-batch gradient descent.Batch sizeUpdates per epochGradient estimate11,000Very noisy10010Moderately noisy1,0001Exact for the data
For 1,000 training examples, a batch size of 100 means each update averages 100 examples and an epoch has 10 updates. A batch of all 1,000 is ordinary full-batch gradient descent.

Epoch

One full pass through the training data.

Answers
How long has the model been trained?
Watch out
More epochs are not always better; beyond a point the model starts to overfit.
Precise definition

An epoch is one complete pass of the training algorithm through the entire training dataset. Training usually runs for many epochs with validation performance checked between them: too few can leave the model underfit, while too many can overfit, which is why training is often stopped early once validation error stops improving.

Often confused with Batch Size

One full pass through the training data
One full pass through the training dataWith 1,000 training examples and a batch size of 100, one epoch is 10 parameter updates. Training for 30 epochs makes 300 updates and shows every example 30 times.1,000 examplestraining setBatches of 10010 updates1 epochall seen once
With 1,000 training examples and a batch size of 100, one epoch is 10 parameter updates. Training for 30 epochs makes 300 updates and shows every example 30 times.

Backpropagation

A way to compute how a small change to each weight would change the loss.

Answers
How does a network know which way to adjust each of its millions of settings?
Watch out
It measures local sensitivity only; it does not divide up blame for an error, and a separate optimizer decides how big a step to take.
Think of it as
Checking, for every dial on a machine at once, which way a small turn would move the output.
Precise definition

Backpropagation efficiently computes derivatives of a neural network's loss with respect to its parameters by applying the chain rule backward through the computation. An optimizer then uses these derivatives to update the parameters, so backpropagation computes gradients rather than choosing the update rule itself.

Often confused with Gradient Descent

Multiply local derivatives along a path
Multiply local derivatives along a pathWith x = 3, w = 2, y = wx, and L = y²/2, the forward pass gives y = 6. Working backward gives ∂L/∂w = 6 × 3 = 18.∂L/∂yy = 6∂y/∂wx = 3∂L/∂w6 × 3 = 18
With x = 3, w = 2, y = wx, and L = y²/2, the forward pass gives y = 6. Working backward gives ∂L/∂w = 6 × 3 = 18.

Vanishing Gradient

A training problem in which the learning signal fades to almost nothing in the early layers of a deep network.

Answers
Why do some deep networks stop improving?
Watch out
It is an obstacle in training, not a property of the finished model.
Think of it as
A message passed down a long line of people, getting fainter each time.
Precise definition

Vanishing gradients occur when derivatives become very small as they are propagated through many layers or time steps. This can prevent earlier parts of a network from learning effectively, and architectures using residual connections, suitable activations, or gated recurrent units can help.

Repeated multiplication shrinks the signal
Repeated multiplication shrinks the signalIf each local derivative equals 0.5, a gradient traveling back ten steps is scaled by 0.5¹⁰ ≈ 0.001. 0.0 2.5 5.0 7.5 10.0 Steps back 0.0 0.3 0.6 0.9 Gradient multiplier
If each local derivative equals 0.5, a gradient traveling back ten steps is scaled by 0.5¹⁰ ≈ 0.001.

Matrix Multiplication

The core arithmetic of machine learning: combining a table of inputs with a table of weights.

Answers
What calculation is a neural network doing billions of times?
Watch out
Order matters: A times B is generally not B times A.
Precise definition

Matrix multiplication combines rows of the first matrix with columns of the second through dot products: an m × k matrix times a k × n matrix produces an m × n matrix. It represents operations such as applying learned linear transformations, and it is different from element-by-element multiplication and generally depends on multiplication order.

Read a dense layer one output at a time
Read a dense layer one output at a timeThe row vector [2, 3] times the displayed 2 × 2 weight matrix gives [14, 5]. Each output uses a different column and both input coordinates.InputWeight to y₁Weight to y₂x₁ = 21−2x₂ = 343Output2×1 + 3×4 = 142×(−2) + 3×3 = 5
The row vector [2, 3] times the displayed 2 × 2 weight matrix gives [14, 5]. Each output uses a different column and both input coordinates.

Regularization

Any technique that deliberately restrains a model to stop it memorizing noise.

Answers
How do we make a model that holds up on new data?
Watch out
Too much restraint causes the opposite problem: a model too simple to be useful.
Think of it as
A spending cap on complexity.
Precise definition

Regularization uses penalties, constraints, or training choices to limit how freely a model can fit the training data. It can improve generalization by trading some fit to the observed sample for greater stability, though excessive regularization can cause underfitting.

See also Generalization, Underfitting

Stronger penalties shrink a fitted coefficient
Stronger penalties shrink a fitted coefficientFor the illustrative objective (w − 4)² + λw², the fitted value is 4/(1 + λ). Increasing λ from 0 to 3 shrinks the coefficient from 4 to 1. 0.0 1.5 3.0 4.5 Penalty strength λ 1 2 3 4 Fitted coefficient
For the illustrative objective (w − 4)² + λw², the fitted value is 4/(1 + λ). Increasing λ from 0 to 3 shrinks the coefficient from 4 to 1.

L1 and L2 Regularization

Two penalties that keep a model simple: L1 pushes unhelpful weights to exactly zero, L2 shrinks all of them.

Answers
How do we stop a model with many inputs from overfitting, or find out which inputs it can drop?
Watch out
Inputs must be on comparable scales first, or the penalty treats them unfairly.
Precise definition

L1 regularization penalizes the sum of absolute parameter values, while L2 regularization penalizes the sum of their squares. In common linear-model settings, L1 can set coefficients exactly to zero, whereas L2 usually shrinks them continuously; feature scaling influences both penalties.

See also Regularization, Overfitting

Compare the penalty shapes
Compare the penalty shapesFor a single coefficient w and unit penalty strength, L1 contributes |w| and L2 contributes w². The sharp corner of L1 at zero helps explain exact zeros in fitted models. -2 -1 0 1 2 Coefficient w 0.0 1.5 3.0 Penalty L1: |w| L2: w²
For a single coefficient w and unit penalty strength, L1 contributes |w| and L2 contributes w². The sharp corner of L1 at zero helps explain exact zeros in fitted models.

Dropout

Randomly switching off parts of a neural network during training so it cannot lean too heavily on any one part.

Answers
How do we stop a neural network from memorizing its training data?
Watch out
It is normally switched off when the model is in use. One exception, Monte Carlo dropout, keeps it on deliberately to estimate uncertainty.
Think of it as
Practicing with random team members absent, so nobody becomes indispensable.
Precise definition

Dropout regularizes a neural network by randomly setting selected activations to zero during training. This discourages reliance on particular combinations of units, while standard prediction typically uses the full network with the appropriate scaling convention.

Apply a random mask during training
Apply a random mask during trainingThe example shows the masking step before any inverted-dropout scaling. Only units 1 and 3 pass through this particular mask.Activations2134Mask1010Masked2030
The example shows the masking step before any inverted-dropout scaling. Only units 1 and 3 pass through this particular mask.

Pre-training

The first, general stage of training on huge amounts of broad data, before a model is specialized.

Answers
Where does a foundation model's general knowledge come from?
Watch out
It bakes in whatever was in the training data, including its gaps, biases, and cutoff date.
Think of it as
A general education before job-specific training.
Precise definition

Pre-training is an initial learning stage that develops reusable model parameters before a particular downstream task is addressed. It may use labeled or unlabeled data, and later adaptation can reuse the learned representation through fine-tuning or other transfer methods.

See also Fine-Tuning

Learn reusable language features
Learn reusable language featuresA model sees many passages and learns to predict withheld or next tokens. The resulting parameters can initialize a model for a more specific task.Large corpusUnlabeled textToken objectivePredict tokensTrained weightsReusable starting point
A model sees many passages and learns to predict withheld or next tokens. The resulting parameters can initialize a model for a more specific task.

Transfer Learning

Starting from a model trained on one task and adapting it to another.

Answers
Can we build a good model without a huge dataset of our own?
Watch out
If the new task differs too much from the original, the head start can hurt rather than help.
Think of it as
A pianist learning the organ: most of the skill carries over.
Precise definition

Transfer learning adapts knowledge learned on one dataset or task to a different but related target task. It can reuse fixed features or fine-tune model parameters, but a poor match between source and target can reduce performance rather than improve it.

Often confused with Fine-Tuning

Adapt an image encoder to a new crop task
Adapt an image encoder to a new crop taskAn encoder first trained on general photographs supplies features for leaf images. Fine-tuning those weights on labeled leaves adapts them to defect prediction.Pretrainedimage encoderLabeled leavesfine-tuneCrop defectclassifier
An encoder first trained on general photographs supplies features for leaf images. Fine-tuning those weights on labeled leaves adapts them to defect prediction.

Knowledge Transfer and Distillation

Reusing what one model has learned to help another, for example by having a small model imitate a large one.

Answers
Can we get most of a big model's quality in something smaller and cheaper to run?
Watch out
The smaller model inherits the larger one's mistakes along with its skills.
Think of it as
An apprentice learning by copying a master.
Precise definition

Knowledge transfer is the broad reuse of information learned in one task, model, or setting to help another. In machine learning it includes approaches such as transfer learning and distillation, but the phrase does not identify one specific algorithm.

See also Transfer Learning

Let a small model mimic a larger one
Let a small model mimic a larger oneIn distillation, the teacher provides target probabilities for training examples. The student learns from this richer signal to approximate the teacher.TeacherLarge classifierSoft targets[0.8, 0.2]StudentCompact model
In distillation, the teacher provides target probabilities for training examples. The student learns from this richer signal to approximate the teacher.

Language, LLMs, and generative AI

14 terms
Terms in this topic

Natural Language Processing (NLP)

The field concerned with getting computers to work with human language.

Answers
What can we automate with text and speech: search, routing, summaries, translation?
Watch out
Performance varies a lot by language, domain, and writing style.
Precise definition

Natural language processing develops computational methods for analyzing, interpreting, and generating human language. Its tasks include information extraction, sentiment analysis, translation, retrieval, and question answering.

See also Information Extraction, Sentiment Analysis

Extract a request from text
Extract a request from textA system processing “reset pump four” can identify a reset action and an equipment identifier. Structured outputs let another application use the result.Textreset pump fourInterpretintent + entityOutputreset / pump 4
A system processing “reset pump four” can identify a reset action and an equipment identifier. Structured outputs let another application use the result.

Language Models

A model that assigns probabilities to text, most familiarly by predicting the next word (some predict masked-out words instead), which lets it generate and analyze text.

Answers
How does software write, summarize, or answer in natural language?
Watch out
Likely-sounding is not the same as true.
Think of it as
Autocomplete, vastly scaled up.
Precise definition

Language models assign probabilities to language sequences or tokens given a context. They can support generation, completion, and other text tasks, but producing a probable continuation does not guarantee that its factual claims are correct.

Often confused with Large Language Model (LLM)

Score possible next tokens
Score possible next tokensFor the example prompt “water the…”, this toy model assigns the highest probability to “plants.” “Other” combines all remaining tokens. plants garden soil other 0.00 0.15 0.30 0.45 Next-token probability
For the example prompt “water the…”, this toy model assigns the highest probability to “plants.” “Other” combines all remaining tokens.

Large Language Model (LLM)

A very large AI model trained on vast amounts of text, typically to predict what comes next, which lets it write, summarize, and answer questions.

Answers
What kind of system is behind chat assistants, and what can it reliably do?
Watch out
It produces plausible text, not verified facts, and knows nothing after its training cutoff unless told.
Think of it as
An extremely well-read assistant who sometimes misremembers and does not flag it.
Precise definition

A large language model is a neural network, usually a transformer, trained on very large amounts of text, typically to predict the next token, and able as a result to generate, summarize, translate, and answer questions in natural language. Its fluent output reflects patterns learned in training rather than verified facts, and its knowledge stops at its training cutoff unless further information is supplied in the prompt.

Often confused with Language Models

Text is generated one token at a time
Text is generated one token at a timeThe model reads the prompt as tokens, assigns a probability to every possible next token, selects one, appends it, and repeats. A whole answer is produced one token at a time.Promptas tokensModelscores tokensPick oneby probabilityAppendand repeat
The model reads the prompt as tokens, assigns a probability to every possible next token, selects one, appends it, and repeats. A whole answer is produced one token at a time.

Token

The small chunks of text, often word pieces, that a language model reads and writes.

Answers
How are usage, cost, and length limits measured for AI models?
Watch out
Tokens are not words: a long or unusual word can be several tokens, and prices are per token.
Precise definition

A token is the unit of text a language model reads and writes: a whole word, a piece of a word, a punctuation mark, or a space joined to a word, depending on the tokenizer. Model limits and usage prices are counted in tokens rather than words; in English a token averages roughly three-quarters of a word, though this varies by language and content.

Often confused with Embedding · See also Language Models

One phrase, five tokens
One phrase, five tokensAn illustrative split of “Unbelievable results!” into five tokens (␣ marks a space). Common words are often a single token, while longer or rarer words break into pieces; the exact split depends on the tokenizer.Token 1Token 2Token 3Token 4Token 5Unbelievable␣results!
An illustrative split of “Unbelievable results!” into five tokens (␣ marks a space). Common words are often a single token, while longer or rarer words break into pieces; the exact split depends on the tokenizer.

Prompt

The instructions and material you give an AI model.

Answers
How do we ask the model for what we actually want?
Watch out
The model knows only what is in the prompt and its training; unstated context and standards are not assumed.
Think of it as
A brief to a capable contractor who has never worked with your company.
Precise definition

A prompt is the input given to a generative model: the instructions, context, examples, and question it must respond to. Because the model has no other knowledge of the task at hand, clear instructions, relevant background, and an example of the desired output usually improve results more than rewording alone.

What a good prompt contains
What a good prompt containsFour parts that commonly improve a response: what to do, the material to work from, an example of the desired output, and limits on what the model may use.Part of the promptExampleInstructionSummarize in three bulletsContextThe attached Q3 sales reportExampleA sample bullet in the right styleConstraintUse only figures from the report
Four parts that commonly improve a response: what to do, the material to work from, an example of the desired output, and limits on what the model may use.

Context Window

The maximum amount of text a language model can consider at one time.

Answers
How much can we give the model in one go: a page, a contract, a whole archive?
Watch out
Anything that does not fit is simply not seen, and very long inputs can dilute attention to details.
Think of it as
The model's desk: only what fits on it can be worked with.
Precise definition

The context window is the maximum amount of text, measured in tokens, that a language model can take into account at once, covering the instructions, any supplied documents, the conversation so far, and the response being generated. Content beyond the limit must be shortened, summarized, or retrieved selectively, and anything outside the window is not available to the model.

See also Language Models

Everything must fit inside the window
Everything must fit inside the windowWith an illustrative 8,000-token window, the instructions, a 5,000-token report, the conversation, and room for the answer just fit. Adding a 3,000-token appendix exceeds the limit, so something must be cut, summarized, or retrieved selectively. 0 2,000 4,000 6,000 8,000 10,000 Tokens Fits Too long limit Instructions Report Conversation Room for answer Appendix
With an illustrative 8,000-token window, the instructions, a 5,000-token report, the conversation, and room for the answer just fit. Adding a 3,000-token appendix exceeds the limit, so something must be cut, summarized, or retrieved selectively.

Temperature

A dial for how predictable or varied a language model's wording is.

Answers
Do we want the same safe answer every time, or more varied and creative ones?
Watch out
Low temperature makes answers consistent, not correct; a wrong answer can be given consistently.
Precise definition

Temperature is a setting that controls how random a language model's choice of next token is, by rescaling the model's scores before they are converted to probabilities. Low values concentrate probability on the most likely tokens, giving more predictable output; higher values flatten the distribution, giving more varied output and a greater chance of unlikely or incorrect continuations.

See also Language Models

Sharper or flatter next-word odds
Sharper or flatter next-word oddsFor the prompt “water the…”, temperature 0.5 gives “plants” a probability of 0.83, temperature 1 gives 0.58, and temperature 2 gives 0.41. Higher temperatures spread probability toward less likely words. plants garden soil other 0.0 0.2 0.4 0.6 0.8 Next-token probability Temperature 0.5 Temperature 1 Temperature 2
For the prompt “water the…”, temperature 0.5 gives “plants” a probability of 0.83, temperature 1 gives 0.58, and temperature 2 gives 0.41. Higher temperatures spread probability toward less likely words.

Hallucination

When an AI model states something false or made up as though it were fact.

Answers
Can we trust what the model just told us?
Watch out
Hallucinations read exactly as fluently and confidently as correct answers.
Think of it as
A confident colleague who fills gaps in memory with plausible guesses.
Precise definition

In generative AI, a hallucination is output that is fluent and plausible but false, unsupported by the supplied sources, or entirely fabricated, such as an invented citation or statistic. It arises because a language model generates probable text rather than retrieving verified facts, so important claims should be checked against sources; grounding the model in supplied documents reduces but does not eliminate the problem.

See also Language Models

A confident answer with nothing behind it
A confident answer with nothing behind itThe answer is fluent and specific, but the source system holds no approval for that invoice. A claim with no support in the supplied or verifiable record is a hallucination, however confident it sounds.StepWhat it saysQuestionWho approved invoice 4471?Model answer“J. Smith, on 3 March.”Source recordNo approval is recordedVerdictUnsupported claim
The answer is fluent and specific, but the source system holds no approval for that invoice. A claim with no support in the supplied or verifiable record is a hallucination, however confident it sounds.

Retrieval-Augmented Generation (RAG)

Having an AI model look up relevant documents first and answer from them.

Answers
How can an AI assistant answer from our own, up-to-date documents?
Watch out
If the search step fetches irrelevant passages, errors become much more likely, however good the model is.
Think of it as
An open-book exam rather than answering from memory.
Precise definition

Retrieval-augmented generation answers a question by first retrieving relevant passages from a document collection and then supplying them to a language model as context for its response. It lets a model use current or private information without retraining and allows answers to cite sources, but answer quality depends on retrieving the right passages.

Often confused with Fine-Tuning · See also Language Models

Look it up first, then answer
Look it up first, then answerThe question is used to search a document store. The best-matching passages are added to the prompt, and the model writes an answer grounded in them and able to cite them.Questionfrom the userRetrievebest passagesAugmentadd to promptGeneratecited answer
The question is used to search a document store. The best-matching passages are added to the prompt, and the model writes an answer grounded in them and able to cite them.

Vector Database

A database that finds items by similarity of meaning rather than by exact matching words.

Answers
How do we search our documents by what they mean rather than by keywords?
Watch out
Results are "nearest", not "correct": unless a similarity threshold or filter is set, it returns its closest matches even when nothing relevant exists.
Precise definition

A vector database stores embeddings, the numerical vectors that represent items such as passages or images, and retrieves those most similar to a query vector, usually with approximate nearest-neighbor search for speed. It is the retrieval component of semantic search and retrieval-augmented generation, and its results depend on the quality of the embedding model and on how documents were split.

Often confused with Nearest Neighbor Search · See also Retrieval-Augmented Generation (RAG), Embedding

Rank stored passages by similarity
Rank stored passages by similarityThe query “How do I reset my password?” is embedded and compared with every stored passage. These illustrative cosine similarities rank the password article first, even though it shares few exact words with the query.Stored passageSimilarity to query“Recovering a forgotten login”0.91“Changing your account email”0.62“Invoice payment terms”0.08
The query “How do I reset my password?” is embedded and compared with every stored passage. These illustrative cosine similarities rank the password article first, even though it shares few exact words with the query.

Fine-Tuning

Further training of an existing model on your own examples so that it specializes.

Answers
Should we customize a model for our task, style, or terminology?
Watch out
It is usually not the way to add facts; retrieval is typically cheaper and easier to keep current.
Precise definition

Fine-tuning continues the training of a pre-trained model on a smaller, task-specific dataset so that its parameters adapt to that task, style, or domain. It can improve consistency on a narrow task, but it requires good examples, risks overfitting to them, and does not by itself give the model access to new facts the way retrieval does.

Often confused with Retrieval-Augmented Generation (RAG), Transfer Learning · See also Overfitting

Continue training on your own examples
Continue training on your own examplesA general model is trained further on 2,000 labeled support tickets. Its weights shift toward that task, producing a specialized model for routing tickets.Pre-trainedgeneral model+ 2,000 ticketslabeled examplesFine-tunedticket router
A general model is trained further on 2,000 labeled support tickets. Its weights shift toward that task, producing a specialized model for routing tickets.

Sentiment Analysis

Automatically judging whether a piece of text is positive, negative, or neutral.

Answers
How do customers feel about us across thousands of reviews or tickets?
Watch out
Sarcasm, mixed opinions, and industry jargon are frequently misread.
Precise definition

Sentiment analysis identifies evaluative tone in text, such as positive, negative, or neutral sentiment toward a topic. Context, sarcasm, and mixed opinions can make the task difficult, so a sentiment label is an interpretation rather than a direct measurement of a person's inner state.

A single review can contain two opinions
A single review can contain two opinionsIn “Fast setup, but the dashboard is confusing,” sentiment about setup is positive and sentiment about the dashboard is negative.AspectText evidenceSentimentSetup“Fast setup”PositiveDashboard“confusing”Negative
In “Fast setup, but the dashboard is confusing,” sentiment about setup is positive and sentiment about the dashboard is negative.

Information Extraction

Pulling structured facts, such as names, dates, and amounts, out of free text.

Answers
Can we turn contracts, emails, or tickets into rows in a table?
Watch out
Extraction errors are silent; sample and check the output before relying on it.
Precise definition

Information extraction converts unstructured content into structured facts such as entities, dates, relationships, or events. For example, a system might extract equipment names and failure times from maintenance notes for later analysis.

Turn a maintenance note into fields
Turn a maintenance note into fieldsFrom “Pump P4 stopped at 08:12 in Zone B,” an extractor can produce three typed values suitable for a maintenance table.EquipmentEvent timeLocationPump P408:12Zone B
From “Pump P4 stopped at 08:12 in Zone B,” an extractor can produce three typed values suitable for a maintenance table.

Knowledge Graphs

A network of facts stored as things and the relationships between them.

Answers
How are our customers, products, and suppliers connected?
Watch out
It is only as current and correct as the facts fed into it.
Precise definition

A knowledge graph represents entities and their relationships as a graph, often with types, attributes, and supporting evidence. It can support structured queries and reasoning, such as linking equipment to rooms, maintenance events, and affected crop batches.

Follow typed relationships
Follow typed relationshipsThe graph represents the facts “Pump P4 serves Zone B” and “Zone B contains Bed 7.” The shared Zone B entity connects the two statements.Pump P4servesZone BcontainsBed 7
The graph represents the facts “Pump P4 serves Zone B” and “Zone B contains Bed 7.” The shared Zone B entity connects the two statements.

Time, simulation, and sequential decisions

6 terms
Terms in this topic

Time Series Analysis

Analyzing data recorded over time to understand trends and cycles and to forecast.

Answers
What is the underlying trend, what is seasonal, and what should we expect next?
Watch out
Forecasts assume the future resembles the past; structural changes break them.
Precise definition

Time series analysis studies observations ordered through time, including trends, seasonality, autocorrelation, and changes in behavior. Because neighboring observations may be dependent, model fitting and evaluation should respect temporal order and the intended forecasting or explanatory task.

See also Autocorrelation

Separate a trend from weekly variation
Separate a trend from weekly variationThe illustrative daily series combines a rising baseline with a seven-day cycle. Points separated by seven days occupy the same part of that cycle. 0 6 12 18 24 Day 105 120 135 Daily harvest (kg) Daily total Trend
The illustrative daily series combines a rising baseline with a seven-day cycle. Points separated by seven days occupy the same part of that cycle.

Autocorrelation

How strongly a series resembles an earlier copy of itself.

Answers
Does this week's figure tell us anything about next week's? Is there a weekly or yearly cycle?
Watch out
Rows are not independent pieces of information. Positive autocorrelation, the common case, makes averages less precise than the row count suggests; negative autocorrelation does the opposite.
Precise definition

Autocorrelation measures association between a time series and a lagged version of itself. It helps reveal persistence and periodic patterns, although trends and other nonstationary behavior can also create strong apparent autocorrelation.

A repeating seven-day signal
A repeating seven-day signalFor a pure weekly sinusoid with random phase, correlation returns to +1 at lags of 7 and 14 days and dips below zero between repeats. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Lag (days) −0.5 0.0 0.5 1.0 Autocorrelation
For a pure weekly sinusoid with random phase, correlation returns to +1 at lags of 7 and 14 days and dips below zero between repeats.

Markov Chain

A model of a system that moves between states, where the next step depends only on the current state.

Answers
How do customers move between stages, such as active, lapsed, and churned, from month to month?
Watch out
The "no memory" assumption often fails; how long someone has been in a state usually matters.
Think of it as
A board game: your next square depends only on where you are now and the dice.
Precise definition

A Markov chain is a stochastic process in which the next state's conditional distribution depends on the current state rather than the complete past history. Transition probabilities describe movement between states, and suitable chains may converge to a stationary distribution.

Read the next-state probabilities by row
Read the next-state probabilities by rowIf the current state is idle, the next state is running with probability 0.30. Each row sums to one.Current / nextIdleRunningIdle0.700.30Running0.200.80
If the current state is idle, the next state is running with probability 0.30. Each row sums to one.

Monte Carlo Simulation

Estimating the range of possible outcomes by simulating a situation thousands of times with random inputs.

Answers
Given all the uncertainties, what range of profit, cost, or completion date should we expect?
Watch out
It is only as good as the assumptions fed in; many runs give precision, not accuracy.
Think of it as
Play the game ten thousand times and count how often you win.
Precise definition

Monte Carlo simulation uses repeated random draws from a model to approximate quantities such as expectations, probabilities, or the spread of possible outcomes. More simulations reduce simulation error, but they do not correct unrealistic assumptions in the model being simulated.

Estimate an area with uniform random draws
Estimate an area with uniform random draws197 of 240 random points fall inside the quarter-circle. Four times that fraction gives π ≈ 3.28, against a true value of 3.14. The typical error shrinks in proportion to 1/√n, so 100 times more points buy about one more correct digit. 0.0 0.2 0.4 0.6 0.8 1.0 x 0.00 0.25 0.50 0.75 1.00 y
197 of 240 random points fall inside the quarter-circle. Four times that fraction gives π ≈ 3.28, against a true value of 3.14. The typical error shrinks in proportion to 1/√n, so 100 times more points buy about one more correct digit.

Reinforcement Learning

Learning by trial and error, guided by rewards.

Answers
How can a system learn a sequence of decisions, such as pricing, routing, or recommendations, by experimenting?
Watch out
The system optimizes exactly the reward it is given, including any loopholes in how that reward was defined.
Think of it as
Training a dog with treats.
Precise definition

Reinforcement learning trains an agent to choose actions through interaction with an environment and feedback expressed as rewards. The goal is usually to maximize expected cumulative reward, requiring a balance between exploring uncertain actions and exploiting actions that already appear useful.

One decision changes later rewards
One decision changes later rewardsIn this toy task, waiting pays +1 and ends the episode. Inspecting pays 0 immediately and opens a repair action worth +3 later.StartWait: +1Inspect: 0Repair: +3
In this toy task, waiting pays +1 and ends the episode. Inspecting pays 0 immediately and opens a repair action worth +3 later.

Evolutionary Algorithms

Search methods that improve solutions by mimicking breeding, mutation, and selection.

Answers
How do we find a good solution to a messy problem, such as a schedule or layout, with no neat formula?
Watch out
They can need a great many trials and give no guarantee of finding the best answer.
Think of it as
Breeding better solutions over generations.
Precise definition

Evolutionary algorithms search for solutions by maintaining a population of candidates and repeatedly applying selection and variation operations such as mutation or crossover. They can optimize objectives without requiring gradients, although they may need many evaluations and do not generally guarantee a global optimum.

Select, recombine, then mutate
Select, recombine, then mutateFor a toy objective that rewards more ones, two parents contribute bits to a child. Flipping its third bit increases its score from three to four.Parent A1100Parent B1001Crossover1101Mutate1111
For a toy objective that rewards more ones, two parents contribute bits to a child. Flipping its third bit increases its score from three to four.

Specialist appendix

6 terms
Terms in this topic

Six entries from version 1 that sit outside everyday business statistics and machine learning. They are kept here for reference.

Hessian Matrix

A table describing how sharply a function curves in every direction.

Answers
How sensitive is the result to small changes in each setting?
Watch out
A specialist tool; for large models it is too big to compute exactly.
Precise definition

The Hessian is the matrix of second partial derivatives of a scalar-valued function with respect to its inputs or parameters. It describes local curvature and is used in second-order optimization and, under suitable statistical assumptions, in estimating parameter uncertainty.

Curvature differs by direction
Curvature differs by directionFor f(x,y) = x² + 4y², the Hessian has diagonal entries 2 and 8. The narrower contour span along y shows the greater curvature. -1.6 -0.8 0.0 0.8 1.6 x -1.2 -0.6 0.0 0.6 1.2 y
For f(x,y) = x² + 4y², the Hessian has diagonal entries 2 and 8. The narrower contour span along y shows the greater curvature.

Jacobian Matrix

A table describing how each output of a system responds to a small change in each input.

Answers
Which outputs move, and by how much, when we nudge each input?
Watch out
It describes small local changes only, not large ones.
Precise definition

The Jacobian is the matrix of first partial derivatives of a vector-valued function, with rows corresponding to outputs and columns to inputs under the usual convention. It describes how small changes in inputs affect outputs and appears in differentiation, optimization, and changes of variables.

One row per output, one column per input
One row per output, one column per inputFor outputs u = x + 2y and v = 3x − y, the Jacobian gives the local response to each input. Increasing y by 1 raises u by 2 and lowers v by 1.Output∂ / ∂x∂ / ∂yu12v3−1
For outputs u = x + 2y and v = 3x − y, the Jacobian gives the local response to each input. Increasing y by 1 raises u by 2 and lowers v by 1.

Black–Scholes Model

A formula for the fair price of an option, given the asset's price, its volatility, the time remaining, and interest rates.

Answers
What is an option worth today?
Watch out
It assumes constant volatility and smooth markets, which is least true exactly when it matters most.
Precise definition

The Black–Scholes model is a mathematical framework for valuing options using assumptions about asset-price dynamics, volatility, interest rates, and trading. Its classic formula prices European-style options under assumptions including constant volatility and frictionless trading, so it is a model-based valuation rather than a prediction of the asset's future price.

A model price before expiration
A model price before expirationThe solid line prices a European call under Black–Scholes with strike 100, six months remaining, 25% volatility, a 3% rate, and no dividends. The dashed line shows the payoff at expiry. 60 80 100 120 140 Underlying price 0 15 30 45 Call value / payoff Model price now Payoff at expiry
The solid line prices a European call under Black–Scholes with strike 100, six months remaining, 25% volatility, a 3% rate, and no dividends. The dashed line shows the payoff at expiry.

Nash Equilibrium

A situation in which no participant can do better by changing strategy on their own.

Answers
Where will competitors' pricing or bidding settle?
Watch out
The stable outcome is not necessarily the best one for anybody.
Precise definition

A Nash equilibrium is a set of strategies in which no player can improve their own payoff by changing only their strategy while the others keep theirs fixed. It need not be unique, cooperative, or best for the group, and it appears in game theory and some multi-agent learning settings.

Check unilateral changes in a payoff matrix
Check unilateral changes in a payoff matrixAt (B, B) both players earn 2. If either alone switches to A, that player’s payoff drops to 0. The first number belongs to the row player.Row / columnABA(3, 3)(0, 4)B(4, 0)(2, 2)
At (B, B) both players earn 2. If either alone switches to A, that player’s payoff drops to 0. The first number belongs to the row player.

Quantum Machine Learning

Research into using quantum computers for machine-learning tasks.

Answers
Should quantum computing change our AI plans?
Watch out
A practical advantage over ordinary computers remains unproven for most business problems.
Precise definition

Quantum machine learning studies how quantum computing and machine learning can be combined, including hybrid systems that use classical and quantum processors. Examples include quantum kernels and parameterized quantum circuits, but a practical advantage depends on the task, data, hardware, and comparison method. Source ↗

One hybrid feature pipeline
One hybrid feature pipelineA classical system encodes features into circuit settings. Measurements from the circuit produce numerical inputs for a classical classifier.Encode featuresas anglesQuantum circuitmeasure outputsClassical modelpredict a label
A classical system encodes features into circuit settings. Measurements from the circuit produce numerical inputs for a classical classifier.

Zero-Knowledge Proof

A way to prove a statement is true without revealing the information behind it.

Answers
Can we prove something, such as being over 18 or solvent, without disclosing the underlying data?
Watch out
It proves the specific statement only; it does not make the underlying data correct.
Think of it as
Proving you know the password without saying it.
Precise definition

A zero-knowledge proof is a cryptographic method that lets a prover establish a statement's truth without revealing additional knowledge beyond what that statement implies. It belongs primarily to cryptography rather than statistics, but can support privacy-preserving verification of computations. Source ↗

Verify a private calculation
Verify a private calculationA prover uses a private input and a public claim to construct a proof. A verifier checks the claim and proof while the private input stays with the prover.Private inputPublic claimConstruct proofVerify claim
A prover uses a private input and a public claim to construct a proof. A verifier checks the claim and proof while the private input stays with the prover.