Skip to main content

· Translation updated

Modern Artificial Intelligence II — Core Learning Tasks and Generalization

A complete page, paragraph, figure, and equation ledger for thirteen ECE5992 pages, connecting classification, regression, density estimation, generalization, regularization, cross-validation, SVMs, minimum-distance and Bayes classifiers, and dimensionality to research through 2026.

한국어 원문

Completeness contract
This article follows all thirteen pages of 1_Ch2 Fundamentals of ML.pdf. Numbered and unnumbered displayed equations, meaningful inline mathematics, equations inside figures, question placeholders ??, captions, footnotes, references, and legible handwriting are individually linked to ledgers. Source blanks and suspected errors are preserved first; completed and corrected variants receive separate statuses.

Keep three layers distinct.
Separate the 2025 PDF reconstruction, editorial and mathematical verification, and the research update dated August 18, 2026. Later research does not retroactively rewrite the lecture’s claims.

#Ledger status

  • PDF mapping: 13 of 13 pages
  • Source equations: 103 (MAI-P2-001–MAI-P2-103)
  • Equation statuses: source-exact, source-suspect, editorially-completed, corrected-variant
  • Source PDF SHA-256: c6ac9d80c5ae2bc96f0aa8aec70c126f559e6dd5c36d51a46eb1bdb6775e836c
  • Figures are reconstructed as new diagrams or precise descriptions preserving axes, legends, values, and structure, rather than reproducing source images.

#Reconstructing the PDF source

#2. Fundamentals of machine learning

Machine learning is introduced as methods that automatically discover patterns in large datasets and use them to predict future data or make decisions under uncertainty. The lecture presents it as a response to automated-analysis demands in the era of big data.

Even an apparently enormous dataset can contain few effective samples of a rare event of interest. The lecture describes this long-tail property: a few events are common, while most are rare.

#2.1 Tasks

#2.1.1 Classification

Classification learns a mapping from inputs to outputs. The output space is y∈{1,…,C}y\in\{1,\ldots,C\}. With C=2C=2, the task is binary classification, usually using y∈{0,1}y\in\{0,1\}; with C>2C>2, it is multiclass classification.

  • Nonexclusive classes give multilabel classification, which can be viewed as a multioutput model predicting several related binary labels together.

Unless otherwise stated, classification here means single-output multiclass classification.

As function approximation, classification assumes an unknown relationship y=f(x)y=f(x) and estimates it from labeled training examples.

Source equation · PDF p. 1

Identify the equation's role and symbols
Dtrain={(xl,yl):l=1,…,L}\mathcal{D}_{\mathrm{train}}=\{(x_l,y_l):l=1,\ldots,L\}
Explanation Core explanation

The question this equation answers

What does this equation define or connect in the article?

Key idea

For equations without an actual calculation or derivation, briefly clarify context and symbols rather than attaching a generic procedure.

Symbols

Symbols used in this equation
SymbolMeaning
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 1 · 2.1.1 Classification Identifier: MAI-P2-006

After learning, y^=f^(x)\hat y=\hat f(x) predicts new inputs. Working well on previously unseen inputs is generalization.

#2.1.2 Regression

Regression predicts numerical values from inputs. The learned function has form f:RN→Rf:\mathbb{R}^{N}\to\mathbb{R}. Its structure resembles classification, but its outputs are real-valued.

The lecture compares a line and quadratic polynomial using one real input xl∈Rx_l\in\mathbb{R} and response yl∈Ry_l\in\mathbb{R}. The page ends by asking which fit looks better, leaving ?? rather than supplying an answer.

Lecture annotation — PDF p. 1
A note appearing to read “path” and a λ symbol occur near the regression example. Context is insufficient to determine their meaning, so the ledger marks them uncertain to read.

Simple linear modelMAI-P2-011: y=b₀+b₁xPolynomial modelMAI-P2-012: y=b₀+b₁x+b₂x²
Figure 1, reconstructed. A line and quadratic curve fit the same scatterplot. Visual fit alone should not select a model; the figure anticipates the need for generalization and validation.
y=b0+b1xy=b_0+b_1x y=b0+b1x+b2x2y=b_0+b_1x+b_2x^2

#2.1.3 Density estimation

Density estimation learns pmodel:RN→Rp_{\mathrm{model}}:\mathbb{R}^{N}\to\mathbb{R}, interpreting pmodel(x)p_{\mathrm{model}}(x) as a PDF or PMF over the space generating samples.

A good density model learns data structure, including dense regions and rarely observed ones. Knowing a density does not automatically solve every related task: required computations can still be intractable.

#2.2 Example: linear regression

The input is x∈RNx\in\mathbb{R}^{N} and output is scalar y∈Ry\in\mathbb{R}. Predictions are defined as follows.

Source equation · PDF p. 2

Identify the equation's role and symbols
y^=wTx\hat y=w^{\mathsf T}x
Explanation Core explanation · Formula-specific lesson

The question this equation answers

What does this equation define or connect in the article?

Key idea

For equations without an actual calculation or derivation, briefly clarify context and symbols rather than attaching a generic procedure.

Formula-specific lesson

Build predictions by adding feature contributions

Decompose wᵀx into component products wᵢxᵢ and their sum rather than treating it as a black box.

Interactive
Loading the lesson matched to this equation and derivation step.

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · 2.2 Linear regression Identifier: MAI-P2-017

Here, w∈RNw\in\mathbb{R}^{N} is the parameter vector. Each component multiplies its corresponding feature, determining that feature’s contribution to prediction.

The learning algorithm adjusts weights using training data (X(train),y(train))\left(X^{(\mathrm{train})},y^{(\mathrm{train})}\right). An intuitive criterion minimizes training mean squared error (MSE).

Source equation · PDF p. 2

MSE has three steps: residuals, squares, and averaging
MSE⁡train=1L∥X(train)w−y(train)∥22\operatorname{MSE}_{\mathrm{train}}=\frac{1}{L}\left\|X^{(\mathrm{train})}w-y^{(\mathrm{train})}\right\|_2^2
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How far are predictions from targets on average?

Key idea

Subtract targets from predictions, square each residual, and divide by sample count. Larger errors receive greater penalties.

Formula-specific lesson

From least squares to normal equations

Keep X, y, and w fixed while connecting predictions, residuals, MSE, gradients, normal equations, and solutions.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate predictions

    For linear regression, predictions are Xw or wᵀx.

    y^=Xw\hat y=Xw
  2. 2

    Calculate residuals

    r=y^−yr=\hat y-y
  3. 3

    Square the residuals

    Remove signs and emphasize larger errors.

    ri2r_i^2
  4. 4

    Sum and divide by sample count

    MSE=1L∑i=1Lri2\mathrm{MSE}=\frac{1}{L}\sum_{i=1}^{L}r_i^2

Worked example

Work through the numbers — MSE for two samples

Compare predictions and targets directly.

  1. 1

    Targets and predictions

    y=[3,1],y^=[2,4]y=[3,1],\quad\hat y=[2,4]
  2. 2

    Residual

    y^−y=[−1,3]\hat y-y=[-1,3]
  3. 3

    Square

    [−1,3]2=[1,9][-1,3]^2=[1,9]
  4. 4

    Average

    (1+9)/2=5(1+9)/2=5

Result: MSE is 5. The second sample's error of 3 substantially increases it.

Sanity check

Checks
  • Check whether the expression divides by sample count or is merely a sum of squares.
  • MSE has squared output units.

Symbols

Symbols used in this equation
SymbolMeaning
XXData matrix collecting samples
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · 2.2 Linear regression Identifier: MAI-P2-020

The lecture derives the normal equation by setting the gradient to zero without skipping intermediate lines.

Source equation · PDF p. 2

A gradient describes the direction and rate of loss change
∇wMSE⁡train=0\nabla_w\operatorname{MSE}_{\mathrm{train}}=0
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How much does the objective increase or decrease when each parameter increases?

Key idea

Collect partial derivatives into a vector and move in the opposite direction during minimization.

Formula-specific lesson

From least squares to normal equations

Keep X, y, and w fixed while connecting predictions, residuals, MSE, gradients, normal equations, and solutions.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose the differentiation variable

    Treat other variables as constants.

  2. 2

    Apply sum, product, and chain rules

    For composition, multiply the outer derivative by the inner derivative.

  3. 3

    Collect partial derivatives into one vector

    ∇f=[∂f/∂x1,…,∂f/∂xN]T\nabla f=[\partial f/\partial x_1,\ldots,\partial f/\partial x_N]^T
  4. 4

    Substitute current values

    Obtain numerical gradient magnitudes and signs.

Worked example

Work through the numbers — Gradient of a one-dimensional loss

The loss squares distance from target value 3.

  1. 1

    Function

    f(w)=(w−3)2f(w)=(w-3)^2
  2. 2

    Derivative

    f′(w)=2(w−3)f'(w)=2(w-3)
  3. 3

    Substitute w=5

    f′(5)=2(5−3)=4f'(5)=2(5-3)=4

Result: The positive gradient 4 means decreasing w reduces loss.

Sanity check

Checks
  • The gradient and parameter vectors must have matching lengths.
  • A constant term has derivative zero.

Symbols

Symbols used in this equation
SymbolMeaning
∇\nablaA gradient collecting derivatives in each variable direction

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · 2.2 Linear regression Identifier: MAI-P2-021

Source equation · PDF p. 2

A gradient describes the direction and rate of loss change
∇w ⁣(1L∥X(train)w−y(train)∥22)=0\nabla_w\!\left(\frac{1}{L}\left\|X^{(\mathrm{train})}w-y^{(\mathrm{train})}\right\|_2^2\right)=0
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How much does the objective increase or decrease when each parameter increases?

Key idea

Collect partial derivatives into a vector and move in the opposite direction during minimization.

Formula-specific lesson

From least squares to normal equations

Keep X, y, and w fixed while connecting predictions, residuals, MSE, gradients, normal equations, and solutions.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose the differentiation variable

    Treat other variables as constants.

  2. 2

    Apply sum, product, and chain rules

    For composition, multiply the outer derivative by the inner derivative.

  3. 3

    Collect partial derivatives into one vector

    ∇f=[∂f/∂x1,…,∂f/∂xN]T\nabla f=[\partial f/\partial x_1,\ldots,\partial f/\partial x_N]^T
  4. 4

    Substitute current values

    Obtain numerical gradient magnitudes and signs.

Worked example

Work through the numbers — Gradient of a one-dimensional loss

The loss squares distance from target value 3.

  1. 1

    Function

    f(w)=(w−3)2f(w)=(w-3)^2
  2. 2

    Derivative

    f′(w)=2(w−3)f'(w)=2(w-3)
  3. 3

    Substitute w=5

    f′(5)=2(5−3)=4f'(5)=2(5-3)=4

Result: The positive gradient 4 means decreasing w reduces loss.

Sanity check

Checks
  • The gradient and parameter vectors must have matching lengths.
  • A constant term has derivative zero.

Symbols

Symbols used in this equation
SymbolMeaning
XXData matrix collecting samples
∇\nablaA gradient collecting derivatives in each variable direction
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · 2.2 Linear regression Identifier: MAI-P2-022

Source equation · PDF p. 2

A gradient describes the direction and rate of loss change
∇w ⁣((X(train)w−y(train))T(X(train)w−y(train)))=0\nabla_w\!\left(\left(X^{(\mathrm{train})}w-y^{(\mathrm{train})}\right)^{\mathsf T}\left(X^{(\mathrm{train})}w-y^{(\mathrm{train})}\right)\right)=0
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How much does the objective increase or decrease when each parameter increases?

Key idea

Collect partial derivatives into a vector and move in the opposite direction during minimization.

Formula-specific lesson

From least squares to normal equations

Keep X, y, and w fixed while connecting predictions, residuals, MSE, gradients, normal equations, and solutions.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose the differentiation variable

    Treat other variables as constants.

  2. 2

    Apply sum, product, and chain rules

    For composition, multiply the outer derivative by the inner derivative.

  3. 3

    Collect partial derivatives into one vector

    ∇f=[∂f/∂x1,…,∂f/∂xN]T\nabla f=[\partial f/\partial x_1,\ldots,\partial f/\partial x_N]^T
  4. 4

    Substitute current values

    Obtain numerical gradient magnitudes and signs.

Worked example

Work through the numbers — Gradient of a one-dimensional loss

The loss squares distance from target value 3.

  1. 1

    Function

    f(w)=(w−3)2f(w)=(w-3)^2
  2. 2

    Derivative

    f′(w)=2(w−3)f'(w)=2(w-3)
  3. 3

    Substitute w=5

    f′(5)=2(5−3)=4f'(5)=2(5-3)=4

Result: The positive gradient 4 means decreasing w reduces loss.

Sanity check

Checks
  • The gradient and parameter vectors must have matching lengths.
  • A constant term has derivative zero.

Symbols

Symbols used in this equation
SymbolMeaning
XXData matrix collecting samples
∇\nablaA gradient collecting derivatives in each variable direction

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · 2.2 Linear regression Identifier: MAI-P2-023

Source equation · PDF p. 2

A gradient describes the direction and rate of loss change
∇w ⁣(wT(X(train))TX(train)w−2wT(X(train))Ty(train)+(y(train))Ty(train))=0\nabla_w\!\left(w^{\mathsf T}\left(X^{(\mathrm{train})}\right)^{\mathsf T}X^{(\mathrm{train})}w-2w^{\mathsf T}\left(X^{(\mathrm{train})}\right)^{\mathsf T}y^{(\mathrm{train})}+\left(y^{(\mathrm{train})}\right)^{\mathsf T}y^{(\mathrm{train})}\right)=0
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How much does the objective increase or decrease when each parameter increases?

Key idea

Collect partial derivatives into a vector and move in the opposite direction during minimization.

Formula-specific lesson

From least squares to normal equations

Keep X, y, and w fixed while connecting predictions, residuals, MSE, gradients, normal equations, and solutions.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose the differentiation variable

    Treat other variables as constants.

  2. 2

    Apply sum, product, and chain rules

    For composition, multiply the outer derivative by the inner derivative.

  3. 3

    Collect partial derivatives into one vector

    ∇f=[∂f/∂x1,…,∂f/∂xN]T\nabla f=[\partial f/\partial x_1,\ldots,\partial f/\partial x_N]^T
  4. 4

    Substitute current values

    Obtain numerical gradient magnitudes and signs.

Worked example

Work through the numbers — Gradient of a one-dimensional loss

The loss squares distance from target value 3.

  1. 1

    Function

    f(w)=(w−3)2f(w)=(w-3)^2
  2. 2

    Derivative

    f′(w)=2(w−3)f'(w)=2(w-3)
  3. 3

    Substitute w=5

    f′(5)=2(5−3)=4f'(5)=2(5-3)=4

Result: The positive gradient 4 means decreasing w reduces loss.

Sanity check

Checks
  • The gradient and parameter vectors must have matching lengths.
  • A constant term has derivative zero.

Symbols

Symbols used in this equation
SymbolMeaning
XXData matrix collecting samples
∇\nablaA gradient collecting derivatives in each variable direction

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · 2.2 Linear regression Identifier: MAI-P2-024

Source equation · PDF p. 2

Identify the equation's role and symbols
2(X(train))TX(train)w−2(X(train))Ty(train)=02\left(X^{(\mathrm{train})}\right)^{\mathsf T}X^{(\mathrm{train})}w-2\left(X^{(\mathrm{train})}\right)^{\mathsf T}y^{(\mathrm{train})}=0
Explanation Core explanation · Formula-specific lesson

The question this equation answers

What does this equation define or connect in the article?

Key idea

For equations without an actual calculation or derivation, briefly clarify context and symbols rather than attaching a generic procedure.

Formula-specific lesson

From least squares to normal equations

Keep X, y, and w fixed while connecting predictions, residuals, MSE, gradients, normal equations, and solutions.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Symbols

Symbols used in this equation
SymbolMeaning
XXData matrix collecting samples

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · 2.2 Linear regression Identifier: MAI-P2-025

Source equation · PDF p. 2

Identify the equation's role and symbols
(X(train))TX(train)w=(X(train))Ty(train)\left(X^{(\mathrm{train})}\right)^{\mathsf T}X^{(\mathrm{train})}w=\left(X^{(\mathrm{train})}\right)^{\mathsf T}y^{(\mathrm{train})}
Explanation Core explanation · Formula-specific lesson

The question this equation answers

What does this equation define or connect in the article?

Key idea

For equations without an actual calculation or derivation, briefly clarify context and symbols rather than attaching a generic procedure.

Formula-specific lesson

From least squares to normal equations

Keep X, y, and w fixed while connecting predictions, residuals, MSE, gradients, normal equations, and solutions.

Interactive
Loading the lesson matched to this equation and derivation step.

Symbols

Symbols used in this equation
SymbolMeaning
XXData matrix collecting samples

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · 2.2 Linear regression Identifier: MAI-P2-026

Source equation · PDF p. 2 · Eq. (1)

The normal equation solves regression weights by setting the MSE gradient to zero
w⋆=((X(train))TX(train))−1(X(train))Ty(train)w^{\star}=\left(\left(X^{(\mathrm{train})}\right)^{\mathsf T}X^{(\mathrm{train})}\right)^{-1}\left(X^{(\mathrm{train})}\right)^{\mathsf T}y^{(\mathrm{train})}
Explanation and calculations 5 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which w minimizes squared linear-regression error?

Key idea

Expand squared error, differentiate with respect to w, and set the result to zero to obtain XᵀXw=Xᵀy.

Formula-specific lesson

From least squares to normal equations

Keep X, y, and w fixed while connecting predictions, residuals, MSE, gradients, normal equations, and solutions.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Write the sum of squared residuals

    J(w)=∥Xw−y∥22J(w)=\lVert Xw-y\rVert_2^2
  2. 2

    Expand the matrix products

    J(w)=wTXTXw−2wTXTy+yTyJ(w)=w^TX^TXw-2w^TX^Ty+y^Ty
  3. 3

    Differentiate with respect to w

    ∇wJ=2XTXw−2XTy\nabla_wJ=2X^TXw-2X^Ty
  4. 4

    Set the gradient to zero at a candidate minimum

    XTXw=XTyX^TXw=X^Ty
  5. 5

    Solve the linear system

    w∗=(XTX)−1XTyw^*=(X^TX)^{-1}X^Ty

Worked example

Work through the numbers — Regressing an intercept and slope

Fit a line to (1,1) and (2,2).

  1. 1

    Construct matrices

    X=[1112],y=[12]X=\begin{bmatrix}1&1\\1&2\end{bmatrix},\quad y=\begin{bmatrix}1\\2\end{bmatrix}
  2. 2

    Calculate products

    XTX=[2335],XTy=[35]X^TX=\begin{bmatrix}2&3\\3&5\end{bmatrix},\quad X^Ty=\begin{bmatrix}3\\5\end{bmatrix}
  3. 3

    Apply the inverse

    (XTX)−1=[5−3−32](X^TX)^{-1}=\begin{bmatrix}5&-3\\-3&2\end{bmatrix}
  4. 4

    Weights

    w∗=[01]w^*=\begin{bmatrix}0\\1\end{bmatrix}

Result: The line y=x, with intercept zero and slope one, passes through both points.

Note: Implementations should use QR, SVD, or a linear solve rather than explicitly forming (XᵀX)⁻¹.

Sanity check

Checks
  • Check whether XᵀX is invertible.
  • The length of w must equal the number of columns of X.

Symbols

Symbols used in this equation
SymbolMeaning
XXData matrix collecting samples

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · Eq. (1) · 2.2 Linear regression Identifier: MAI-P2-027

The final expression is source equation (1). Its inverse form implicitly assumes an invertible Gram matrix.

Source equation · PDF p. 2

A gradient describes the direction and rate of loss change
∂∂x(y−Ax)TW(y−Ax)=−2ATW(y−Ax)\frac{\partial}{\partial x}(y-Ax)^{\mathsf T}W(y-Ax)=-2A^{\mathsf T}W(y-Ax)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How much does the objective increase or decrease when each parameter increases?

Key idea

Collect partial derivatives into a vector and move in the opposite direction during minimization.

Formula-specific lesson

Differentiate squared residuals to build a gradient

Trace the chain rule: compute Ax−y, weight residuals, and map back through Aᵀ to obtain 2AᵀW(Ax−y).

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose the differentiation variable

    Treat other variables as constants.

  2. 2

    Apply sum, product, and chain rules

    For composition, multiply the outer derivative by the inner derivative.

  3. 3

    Collect partial derivatives into one vector

    ∇f=[∂f/∂x1,…,∂f/∂xN]T\nabla f=[\partial f/\partial x_1,\ldots,\partial f/\partial x_N]^T
  4. 4

    Substitute current values

    Obtain numerical gradient magnitudes and signs.

Worked example

Work through the numbers — Gradient of a one-dimensional loss

The loss squares distance from target value 3.

  1. 1

    Function

    f(w)=(w−3)2f(w)=(w-3)^2
  2. 2

    Derivative

    f′(w)=2(w−3)f'(w)=2(w-3)
  3. 3

    Substitute w=5

    f′(5)=2(5−3)=4f'(5)=2(5-3)=4

Result: The positive gradient 4 means decreasing w reduces loss.

Sanity check

Checks
  • The gradient and parameter vectors must have matching lengths.
  • A constant term has derivative zero.

Symbols

Symbols used in this equation
SymbolMeaning
∂\partialPartial derivative with respect to a particular variable

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · 2.2 Linear regression Identifier: MAI-P2-028

The source attributes this derivative identity to The Matrix Cookbook.

Lecture annotation — PDF p. 2, training-sample notation
The note reads (x_l,y_l) as one training sample and stacks rowwise feature vectors to form X^(train).

Source equation · PDF p. 2

Identify the equation's role and symbols
argmin⁡w  1L∑l=1L(wTxl−yl)2\underset{w}{\operatorname{argmin}}\;\frac{1}{L}\sum_{l=1}^{L}(w^{\mathsf T}x_l-y_l)^2
Explanation Core explanation · Formula-specific lesson

The question this equation answers

What does this equation define or connect in the article?

Key idea

For equations without an actual calculation or derivation, briefly clarify context and symbols rather than attaching a generic procedure.

Formula-specific lesson

Assemble sample sums into matrix expressions

Accumulate xₗxₗᵀ into XᵀX and verify numerically that summed sample errors equal ‖Xw−y‖².

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Symbols

Symbols used in this equation
SymbolMeaning
∑\sumSum over all specified terms
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · Page 2 lecture annotation Identifier: MAI-P2-032

Source equation · PDF p. 2

MSE has three steps: residuals, squares, and averaging
1L∥[x1T⋮xLT]w−[y1⋮yL]∥22\frac{1}{L}\left\|\begin{bmatrix}x_1^{\mathsf T}\\ \vdots\\ x_L^{\mathsf T}\end{bmatrix}w-\begin{bmatrix}y_1\\ \vdots\\ y_L\end{bmatrix}\right\|_2^2
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How far are predictions from targets on average?

Key idea

Subtract targets from predictions, square each residual, and divide by sample count. Larger errors receive greater penalties.

Formula-specific lesson

Assemble sample sums into matrix expressions

Accumulate xₗxₗᵀ into XᵀX and verify numerically that summed sample errors equal ‖Xw−y‖².

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate predictions

    For linear regression, predictions are Xw or wᵀx.

    y^=Xw\hat y=Xw
  2. 2

    Calculate residuals

    r=y^−yr=\hat y-y
  3. 3

    Square the residuals

    Remove signs and emphasize larger errors.

    ri2r_i^2
  4. 4

    Sum and divide by sample count

    MSE=1L∑i=1Lri2\mathrm{MSE}=\frac{1}{L}\sum_{i=1}^{L}r_i^2

Worked example

Work through the numbers — MSE for two samples

Compare predictions and targets directly.

  1. 1

    Targets and predictions

    y=[3,1],y^=[2,4]y=[3,1],\quad\hat y=[2,4]
  2. 2

    Residual

    y^−y=[−1,3]\hat y-y=[-1,3]
  3. 3

    Square

    [−1,3]2=[1,9][-1,3]^2=[1,9]
  4. 4

    Average

    (1+9)/2=5(1+9)/2=5

Result: MSE is 5. The second sample's error of 3 substantially increases it.

Sanity check

Checks
  • Check whether the expression divides by sample count or is merely a sum of squares.
  • MSE has squared output units.

Symbols

Symbols used in this equation
SymbolMeaning
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · Page 2 lecture annotation Identifier: MAI-P2-033

Source equation · PDF p. 2

A gradient describes the direction and rate of loss change
∂∂x(ax−b)2=2a(ax−b)\frac{\partial}{\partial x}(ax-b)^2=2a(ax-b)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How much does the objective increase or decrease when each parameter increases?

Key idea

Collect partial derivatives into a vector and move in the opposite direction during minimization.

Formula-specific lesson

Differentiate squared residuals to build a gradient

Trace the chain rule: compute Ax−y, weight residuals, and map back through Aᵀ to obtain 2AᵀW(Ax−y).

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose the differentiation variable

    Treat other variables as constants.

  2. 2

    Apply sum, product, and chain rules

    For composition, multiply the outer derivative by the inner derivative.

  3. 3

    Collect partial derivatives into one vector

    ∇f=[∂f/∂x1,…,∂f/∂xN]T\nabla f=[\partial f/\partial x_1,\ldots,\partial f/\partial x_N]^T
  4. 4

    Substitute current values

    Obtain numerical gradient magnitudes and signs.

Worked example

Work through the numbers — Gradient of a one-dimensional loss

The loss squares distance from target value 3.

  1. 1

    Function

    f(w)=(w−3)2f(w)=(w-3)^2
  2. 2

    Derivative

    f′(w)=2(w−3)f'(w)=2(w-3)
  3. 3

    Substitute w=5

    f′(5)=2(5−3)=4f'(5)=2(5-3)=4

Result: The positive gradient 4 means decreasing w reduces loss.

Sanity check

Checks
  • The gradient and parameter vectors must have matching lengths.
  • A constant term has derivative zero.

Symbols

Symbols used in this equation
SymbolMeaning
∂\partialPartial derivative with respect to a particular variable

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · Page 2 lecture annotation Identifier: MAI-P2-029

Source equation · PDF p. 2

A gradient describes the direction and rate of loss change
∇x∥Ax−y∥22=2AT(Ax−y)\nabla_x\|Ax-y\|_2^2=2A^{\mathsf T}(Ax-y)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How much does the objective increase or decrease when each parameter increases?

Key idea

Collect partial derivatives into a vector and move in the opposite direction during minimization.

Formula-specific lesson

Differentiate squared residuals to build a gradient

Trace the chain rule: compute Ax−y, weight residuals, and map back through Aᵀ to obtain 2AᵀW(Ax−y).

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose the differentiation variable

    Treat other variables as constants.

  2. 2

    Apply sum, product, and chain rules

    For composition, multiply the outer derivative by the inner derivative.

  3. 3

    Collect partial derivatives into one vector

    ∇f=[∂f/∂x1,…,∂f/∂xN]T\nabla f=[\partial f/\partial x_1,\ldots,\partial f/\partial x_N]^T
  4. 4

    Substitute current values

    Obtain numerical gradient magnitudes and signs.

Worked example

Work through the numbers — Gradient of a one-dimensional loss

The loss squares distance from target value 3.

  1. 1

    Function

    f(w)=(w−3)2f(w)=(w-3)^2
  2. 2

    Derivative

    f′(w)=2(w−3)f'(w)=2(w-3)
  3. 3

    Substitute w=5

    f′(5)=2(5−3)=4f'(5)=2(5-3)=4

Result: The positive gradient 4 means decreasing w reduces loss.

Sanity check

Checks
  • The gradient and parameter vectors must have matching lengths.
  • A constant term has derivative zero.

Symbols

Symbols used in this equation
SymbolMeaning
∇\nablaA gradient collecting derivatives in each variable direction

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · Page 2 lecture annotation Identifier: MAI-P2-030

Source equation · PDF p. 2

Identify the equation's role and symbols
XTX=∑l=1LxlxlTX^{\mathsf T}X=\sum_{l=1}^{L}x_lx_l^{\mathsf T}
Explanation Core explanation · Formula-specific lesson

The question this equation answers

What does this equation define or connect in the article?

Key idea

For equations without an actual calculation or derivation, briefly clarify context and symbols rather than attaching a generic procedure.

Formula-specific lesson

Assemble sample sums into matrix expressions

Accumulate xₗxₗᵀ into XᵀX and verify numerically that summed sample errors equal ‖Xw−y‖².

Interactive
Loading the lesson matched to this equation and derivation step.

Symbols

Symbols used in this equation
SymbolMeaning
XXData matrix collecting samples
∑\sumSum over all specified terms
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 2 · Page 2 lecture annotation Identifier: MAI-P2-031

Uncertain reading — lower-right PDF p. 2
A dimensional comparison resembling L ≫ N and a numerical example are obscured by overlapping handwriting. Their location is retained without speculative reconstruction.

#2.3 Underfitting and overfitting

The central machine-learning challenge is maintaining performance on inputs not used in training. This is generalization.

Optimizing parameters to reduce training-set error is an optimization problem. Machine learning adds the requirement of low generalization or test error: expected error on new inputs.

The linear-regression example evaluates the model from equation (1) on a test set.

Source equation · PDF p. 3

MSE has three steps: residuals, squares, and averaging
MSE⁡test=1M∥X(test)w⋆−y(test)∥22\operatorname{MSE}_{\mathrm{test}}=\frac{1}{M}\left\|X^{(\mathrm{test})}w^{\star}-y^{(\mathrm{test})}\right\|_2^2
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How far are predictions from targets on average?

Key idea

Subtract targets from predictions, square each residual, and divide by sample count. Larger errors receive greater penalties.

Formula-specific lesson

Test training-selected w★ on new data

Choose w★ from training data only, average squared residuals on independent test data, and repeat the whole procedure to distinguish expected training and test errors.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate predictions

    For linear regression, predictions are Xw or wᵀx.

    y^=Xw\hat y=Xw
  2. 2

    Calculate residuals

    r=y^−yr=\hat y-y
  3. 3

    Square the residuals

    Remove signs and emphasize larger errors.

    ri2r_i^2
  4. 4

    Sum and divide by sample count

    MSE=1L∑i=1Lri2\mathrm{MSE}=\frac{1}{L}\sum_{i=1}^{L}r_i^2

Worked example

Work through the numbers — MSE for two samples

Compare predictions and targets directly.

  1. 1

    Targets and predictions

    y=[3,1],y^=[2,4]y=[3,1],\quad\hat y=[2,4]
  2. 2

    Residual

    y^−y=[−1,3]\hat y-y=[-1,3]
  3. 3

    Square

    [−1,3]2=[1,9][-1,3]^2=[1,9]
  4. 4

    Average

    (1+9)/2=5(1+9)/2=5

Result: MSE is 5. The second sample's error of 3 substantially increases it.

Sanity check

Checks
  • Check whether the expression divides by sample count or is merely a sum of squares.
  • MSE has squared output units.

Symbols

Symbols used in this equation
SymbolMeaning
XXData matrix collecting samples

Reference-quality follow-up

Explore this calculation further
PDF p. 3 · 2.3 Overfitting and underfitting Identifier: MAI-P2-034

Here, M is the number of test samples.

Training and test data are modeled as draws from a data-generating distribution. The typical i.i.d. assumption makes samples independent and gives training and test sets the same distribution.

For a procedure that samples training data, optimizes parameters, and then samples test data, the lecture explains that expected test error is no smaller than expected training error.

Source equation · PDF p. 3

Expectation is the long-run average formed by summing values times probabilities
E[error⁡test]≥E[error⁡train]\mathbb{E}[\operatorname{error}_{\mathrm{test}}]\geq\mathbb{E}[\operatorname{error}_{\mathrm{train}}]
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Where does the average tend after many repetitions of the same experiment?

Key idea

Multiply each outcome by its probability and sum. For continuous variables, integrate instead.

Formula-specific lesson

Test training-selected w★ on new data

Choose w★ from training data only, average squared residuals on independent test data, and repeat the whole procedure to distinguish expected training and test errors.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Pair possible values with their probabilities

    (xi,pi)(x_i,p_i)
  2. 2

    Multiply each value by its probability

    xipix_ip_i
  3. 3

    Add all terms

    E[X]=∑ixipiE[X]=\sum_i x_ip_i
  4. 4

    Check that probabilities sum to one

    ∑ipi=1\sum_i p_i=1

Worked example

Work through the numbers — Mean of a discrete random variable

X takes 1,2,3 with probabilities 0.2,0.5,0.3 respectively.

  1. 1

    Weighted values

    1(0.2), 2(0.5), 3(0.3)1(0.2),\ 2(0.5),\ 3(0.3)
  2. 2

    Sum

    0.2+1.0+0.9=2.10.2+1.0+0.9=2.1

Result: E[X]=2.1. It need not be an observable outcome itself.

Sanity check

Checks
  • Probabilities or densities must be normalized.
  • E[g(X)] generally differs from g(E[X]).

Symbols

Symbols used in this equation
SymbolMeaning
E\mathbb{E}Expectation: the probability-weighted average of possible values

Reference-quality follow-up

Explore this calculation further
PDF p. 3 · 2.3 Overfitting and underfitting Identifier: MAI-P2-035
  • A good learning algorithm should achieve low training error.
  • It should also keep the gap between training and test errors small.

Underfitting occurs when the model cannot obtain sufficiently low error even on training data.

Overfitting occurs when the training–test error gap is excessively large.

Changing model capacity controls these possibilities. Low capacity may fail to represent the training set; high capacity may memorize properties that do not help on test data.

#2.3.1 No free lunch theorem

“All models are wrong, but some are useful.” — George Box

Machine learning designs models and fitting algorithms. Cross-validation can select empirically better methods for a particular problem, but no single model is optimal for every problem: assumptions useful in one domain can hurt in another.

Uncertain reading — bottom of PDF p. 3
Handwriting following “example” cannot be determined reliably because of image resolution and overlapping strokes.

Underfitting

A simple line misses the samples’ curvature, producing high training error.

Overfitting

An excessively complex curve oscillates through samples, widening the training–test gap.

Appropriate capacity

A curve follows the overall trend without chasing local noise.

Figure 2, reconstructed. Compare insufficient, excessive, and appropriate capacity in one view.
Underfitting — Excessive λ

The degree-nine model becomes almost flat and underfits.

Appropriate weight decay — Medium λ

Suppressing high-order oscillations brings the fit closer to the true quadratic.

Overfitting — λ→0

An overfitted curve diverges strongly at the boundaries.

Figure 3, reconstructed. The true function is quadratic, but all models have degree nine; varying only λ illustrates regularization.

The no-free-lunch result motivates multiple model families for varied real data structures. Even the same model has different speed, accuracy, and complexity trade-offs under different training algorithms.

#2.3.2 Regularization

A learning algorithm can incorporate preferences suited to a task. Performance improves when those preferences match the problem’s structure.

The linear-regression example adds weight decay to favor smaller weights.

Source equation · PDF p. 4

MSE has three steps: residuals, squares, and averaging
MSE⁡train+λ∥w∥22\operatorname{MSE}_{\mathrm{train}}+\lambda\|w\|_2^2
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How far are predictions from targets on average?

Key idea

Subtract targets from predictions, square each residual, and divide by sample count. Larger errors receive greater penalties.

Formula-specific lesson

Balancing training error and small weights with λ

Keep the same degree-nine model and training points while varying λ to calculate MSE_train, ‖w‖², λ‖w‖², total objective, and curve changes together.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate predictions

    For linear regression, predictions are Xw or wᵀx.

    y^=Xw\hat y=Xw
  2. 2

    Calculate residuals

    r=y^−yr=\hat y-y
  3. 3

    Square the residuals

    Remove signs and emphasize larger errors.

    ri2r_i^2
  4. 4

    Sum and divide by sample count

    MSE=1L∑i=1Lri2\mathrm{MSE}=\frac{1}{L}\sum_{i=1}^{L}r_i^2

Worked example

Work through the numbers — MSE for two samples

Compare predictions and targets directly.

  1. 1

    Targets and predictions

    y=[3,1],y^=[2,4]y=[3,1],\quad\hat y=[2,4]
  2. 2

    Residual

    y^−y=[−1,3]\hat y-y=[-1,3]
  3. 3

    Square

    [−1,3]2=[1,9][-1,3]^2=[1,9]
  4. 4

    Average

    (1+9)/2=5(1+9)/2=5

Result: MSE is 5. The second sample's error of 3 substantially increases it.

Sanity check

Checks
  • Check whether the expression divides by sample count or is merely a sum of squares.
  • MSE has squared output units.

Symbols

Symbols used in this equation
SymbolMeaning
λ\lambdaRegularization strength or eigenvalue

Reference-quality follow-up

Explore this calculation further
PDF p. 4 · 2.3.2 Regularization Identifier: MAI-P2-036

λ is selected in advance. With λ=0\lambda=0 there is no small-weight preference; larger λ shrinks weights more strongly.

λ→0\lambda\to0

Figure 3 compares underfitting at excessive λ, a suitable intermediate fit, and overfitting near zero.

Preferences can be explicit or implicit. This example explicitly favors small-weight linear functions through an added objective term.

Lecture annotation — right of Figure 2, PDF p. 4
Added error-versus-iteration curves distinguish three trends appearing to indicate training, test, and underfitting.

Uncertain reading — lower-right PDF p. 4
Partially legible short notes are not completed by guessing their meaning.

These different ways of introducing preferences are collectively called regularization.

Regularization is any modification of a learning algorithm intended to reduce generalization error rather than training error.

Just as no algorithm is best for every problem, no regularizer is universally best. Choose one suited to the task.

The lecture summarizes deep learning’s philosophy as solving broad classes of tasks effectively through very general forms of regularization.

#2.4 Hyperparameters and validation sets

Most learning algorithms have hyperparameters controlling their behavior. These are not the model parameters adapted by the algorithm itself.

Polynomial degree in Figure 1 is a capacity hyperparameter, as is weight-decay λ.

Some settings remain hyperparameters because optimization is difficult. More commonly, learning them on the training set is inappropriate: choosing capacity there can favor the maximum available capacity and overfit.

A validation set unseen by the training algorithm addresses this problem.

#2.4.1 Training, validation, and test sets

  • Training set: learns model parameters.
  • Validation set: estimates generalization to unseen data and selects hyperparameters and configurations.
  • Test set: evaluates the final frozen model on genuinely unseen data for an unbiased generalization estimate.
Train
Validation
Test
Hyperparameter candidates

iterations, depth, width, optimizer, learning rate, batch size, epochs, …

→
Model — parameter tuning
Frozen model — one final test
Unnumbered source diagram: training fits model parameters, validation selects configurations, and testing evaluates the frozen model at the end.

Lecture annotation — PDF p. 5
Notes appearing to read “hyper” beside the hyperparameter heading and “dropout” near regularization are present.

Iteration 1 [TEST][TRAIN][TRAIN][TRAIN][TRAIN]
Iteration 2 [TRAIN][TEST][TRAIN][TRAIN][TRAIN]
Iteration 3 [TRAIN][TRAIN][TEST][TRAIN][TRAIN]
⋮
Iteration k [TRAIN][TRAIN][TRAIN][TRAIN][TEST]
Figure 4, reconstructed. Rotate K nonoverlapping subsets through evaluation while training on the remainder.

#2.4.2 Cross-validation

With a small test set in a fixed split, statistical uncertainty in mean test error makes claims that algorithm A beats B difficult.

This matters less with hundreds of thousands of samples. Small datasets can instead spend extra computation on repeated training and evaluation across splits, using all samples to estimate mean test error.

The usual K-fold procedure divides data into K disjoint subsets and runs K experiments. Run k tests on subset k and trains on the remainder; average the K test errors.

Section-specific concept lesson

K-fold: test each sample once without including it in training during that run

The source section has no displayed equation, so no formula ID is invented. Figure 4 and the procedure are verified through a separate concept ID.

run12345678910error
1TESTtraintraintraintrainTESTtraintraintraintrain0.12
2trainTESTtraintraintraintrainTESTtraintraintrain0.18
3traintrainTESTtraintraintraintrainTESTtraintrain0.10
4traintraintrainTESTtraintraintraintrainTESTtrain0.16
5traintraintraintrainTESTtraintraintraintrainTEST0.14

#2.5 Supervised-learning example: support vector machines

Like logistic regression, an SVM centers on a linear function wTx+bw^{\mathsf T}x+b but outputs class identity rather than probability. It predicts positive for wTx+b>0w^{\mathsf T}x+b>0 and negative for wTx+b<0w^{\mathsf T}x+b<0.

Its key innovation is the kernel trick. Learning algorithms expressible through sample inner products can fit linear models in transformed spaces without explicitly constructing high-dimensional features.

The footnote introduces logistic regression as generalized linear regression for binary classification: targets are y∈{0,1}y\in\{0,1\}, and σ(wTx+b)\sigma(w^{\mathsf T}x+b) squashes the linear output for probabilistic interpretation.

Source equation · PDF p. 6

A sigmoid compresses a real-valued score between zero and one
σ(x)=11+e−x∈(0,1)\sigma(x)=\frac{1}{1+e^{-x}}\in(0,1)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How can a linear score become interpretable as a probability?

Key idea

Negate score z, exponentiate, and take the reciprocal of 1+e^{-z}.

Formula-specific lesson

From linear scores to kernel scores

Keep the query and support vectors fixed while calculating inner-product sums, feature-map kernel identities, and Gaussian kernel scores, distinguishing the logistic-sigmoid footnote from SVM scores.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the linear score z

    z=wTx+bz=w^Tx+b
  2. 2

    Calculate the negative exponential

    e−ze^{-z}
  3. 3

    Add one

    1+e−z1+e^{-z}
  4. 4

    Take the reciprocal

    σ(z)=1/(1+e−z)\sigma(z)=1/(1+e^{-z})

Worked example

Work through the numbers — When z=2

Observe how a positive score becomes an output value.

  1. 1

    Exponentiation

    e−2≈0.1353e^{-2}\approx0.1353
  2. 2

    Denominator

    1+0.1353=1.13531+0.1353=1.1353
  3. 3

    Reciprocal

    1/1.1353≈0.8811/1.1353\approx0.881

Result: The output is approximately 0.881.

Sanity check

Checks
  • At z=0, it is exactly 0.5.
  • Large positive scores approach one; large negative scores approach zero.

Symbols

Symbols used in this equation
SymbolMeaning
σ\sigmaStandard deviation or sigmoid notation

Reference-quality follow-up

Explore this calculation further
PDF p. 6 · Page 6 footnote Identifier: MAI-P2-044

The SVM linear function can be rewritten as a sum of inner products with training samples.

Source equation · PDF p. 7

A hyperplane classifier separates classes by a weighted score's sign
wTx+b=b+∑l=1LαlxTxlw^{\mathsf T}x+b=b+\sum_{l=1}^{L}\alpha_l x^{\mathsf T}x_l
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which side of the decision boundary contains input x?

Key idea

Calculate wᵀx+b: positive assigns one class, negative the other, and zero lies on the boundary.

Formula-specific lesson

From linear scores to kernel scores

Keep the query and support vectors fixed while calculating inner-product sums, feature-map kernel identities, and Gaussian kernel scores, distinguishing the logistic-sigmoid footnote from SVM scores.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Multiply corresponding features and weights

    wixiw_ix_i
  2. 2

    Sum the products and add bias

    g(x)=wTx+bg(x)=w^Tx+b
  3. 3

    Check the sign

    g(x)>0⇒+1,g(x)<0⇒−1g(x)>0\Rightarrow+1,\quad g(x)<0\Rightarrow-1
  4. 4

    Calculate boundary distance if needed

    distance=∣g(x)∣/∥w∥2\mathrm{distance}=|g(x)|/\lVert w\rVert_2

Worked example

Work through the numbers — Classifying one point

w=[1,-2], x=[3,1], and b=0.5.

  1. 1

    Weighted sum

    1⋅3+(−2)⋅1+0.5=1.51\cdot3+(-2)\cdot1+0.5=1.5
  2. 2

    Class

    sign⁡(1.5)=+1\operatorname{sign}(1.5)=+1
  3. 3

    Distance to the boundary

    1.5/12+(−2)2≈0.671.5/\sqrt{1^2+(-2)^2}\approx0.67

Result: The point is on the positive-class side, approximately 0.67 from the boundary.

Sanity check

Checks
  • w and x must have the same dimension.
  • Geometric distance requires |g(x)|, while signed distance may retain its sign.

Symbols

Symbols used in this equation
SymbolMeaning
α\alphaLearning rate, mixture coefficient, or dual coefficient
∑\sumSum over all specified terms
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 7 · 2.5 Support vector machine Identifier: MAI-P2-045

Here, x_l is a training sample and α a coefficient vector. Map inputs through φ(x), then replace inner products with a kernel.

Source equation · PDF p. 7

A kernel computes feature-space inner products or similarities without constructing that space explicitly
κ(x,xl)=ϕ(x)Tϕ(xl)\kappa(x,x_l)=\phi(x)^{\mathsf T}\phi(x_l)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How can a nonlinear relationship become a similarity score usable by a linear model?

Key idea

Use input distances or feature-space inner products to produce scalar similarity κ(u,v).

Formula-specific lesson

From linear scores to kernel scores

Keep the query and support vectors fixed while calculating inner-product sums, feature-map kernel identities, and Gaussian kernel scores, distinguishing the logistic-sigmoid footnote from SVM scores.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference between inputs

    r=u−vr=u-v
  2. 2

    Calculate squared distance

    ∥r∥22\lVert r\rVert_2^2
  3. 3

    Divide by the kernel-width factor

    ∥r∥22/(2σ2)\lVert r\rVert_2^2/(2\sigma^2)
  4. 4

    Apply a negative exponential for similarity

    κ(u,v)=e−∥u−v∥2/(2σ2)\kappa(u,v)=e^{-\lVert u-v\rVert^2/(2\sigma^2)}

Worked example

Work through the numbers — The RBF kernel

u=[0,0], v=[1,1], and σ=1.

  1. 1

    Squared distance

    (0−1)2+(0−1)2=2(0-1)^2+(0-1)^2=2
  2. 2

    Exponentiation

    e−2/(2⋅12)=e−1≈0.368e^{-2/(2\cdot1^2)}=e^{-1}\approx0.368

Result: The points' RBF similarity is approximately 0.368.

Sanity check

Checks
  • For u=v, the RBF kernel equals one.
  • Very small σ makes most distinct points nearly zero in similarity; very large σ makes them similar.

Symbols

Symbols used in this equation
SymbolMeaning
κ\kappaA kernel returning similarity between two inputs
ϕ\phiA transformation into feature space

Reference-quality follow-up

Explore this calculation further
PDF p. 7 · 2.5 Support vector machine Identifier: MAI-P2-046

Source equation · PDF p. 7

A kernel computes feature-space inner products or similarities without constructing that space explicitly
f(x)=b+∑l=1Lαlκ(x,xl)f(x)=b+\sum_{l=1}^{L}\alpha_l\kappa(x,x_l)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How can a nonlinear relationship become a similarity score usable by a linear model?

Key idea

Use input distances or feature-space inner products to produce scalar similarity κ(u,v).

Formula-specific lesson

From linear scores to kernel scores

Keep the query and support vectors fixed while calculating inner-product sums, feature-map kernel identities, and Gaussian kernel scores, distinguishing the logistic-sigmoid footnote from SVM scores.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference between inputs

    r=u−vr=u-v
  2. 2

    Calculate squared distance

    ∥r∥22\lVert r\rVert_2^2
  3. 3

    Divide by the kernel-width factor

    ∥r∥22/(2σ2)\lVert r\rVert_2^2/(2\sigma^2)
  4. 4

    Apply a negative exponential for similarity

    κ(u,v)=e−∥u−v∥2/(2σ2)\kappa(u,v)=e^{-\lVert u-v\rVert^2/(2\sigma^2)}

Worked example

Work through the numbers — The RBF kernel

u=[0,0], v=[1,1], and σ=1.

  1. 1

    Squared distance

    (0−1)2+(0−1)2=2(0-1)^2+(0-1)^2=2
  2. 2

    Exponentiation

    e−2/(2⋅12)=e−1≈0.368e^{-2/(2\cdot1^2)}=e^{-1}\approx0.368

Result: The points' RBF similarity is approximately 0.368.

Sanity check

Checks
  • For u=v, the RBF kernel equals one.
  • Very small σ makes most distinct points nearly zero in similarity; very large σ makes them similar.

Symbols

Symbols used in this equation
SymbolMeaning
α\alphaLearning rate, mixture coefficient, or dual coefficient
κ\kappaA kernel returning similarity between two inputs
∑\sumSum over all specified terms
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 7 · 2.5 Support vector machine Identifier: MAI-P2-047

The function may be nonlinear in x while remaining linear in φ(x) and in α. This corresponds exactly to transforming every input through φ and learning a linear model in that space.

  • With φ fixed and only α optimized, a model nonlinear in original inputs can be learned through convex optimization.
  • κ may be much cheaper to compute than explicitly constructing and dotting the high-dimensional feature vectors.

The lecture’s representative example is the Gaussian kernel.

Source equation · PDF p. 7

Gaussian density uses standardized distance from the mean
κ(u,v)=N(u−v;0,σ2I)\kappa(u,v)=\mathcal{N}(u-v;0,\sigma^2I)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How plausible is observation x under mean μ and covariance Σ?

Key idea

Calculate a covariance-scaled distance from the mean and a normalization constant to obtain density.

Formula-specific lesson

From linear scores to kernel scores

Keep the query and support vectors fixed while calculating inner-product sums, feature-map kernel identities, and Gaussian kernel scores, distinguishing the logistic-sigmoid footnote from SVM scores.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference from the mean

    r=x−μr=x-\mu
  2. 2

    Adjust distance using variance or covariance

    d2=rTΣ−1rd^2=r^T\Sigma^{-1}r
  3. 3

    Calculate exponential decay

    exp⁡(−d2/2)\exp(-d^2/2)
  4. 4

    Divide by the normalization constant

    (2π)N/2∣Σ∣1/2(2\pi)^{N/2}|\Sigma|^{1/2}

Worked example

Work through the numbers — x=1 under a standard normal

A one-dimensional Gaussian with μ=0 and σ=1.

  1. 1

    Standardized distance

    z=(1−0)/1=1z=(1-0)/1=1
  2. 2

    Exponential term

    e−12/2=e−0.5≈0.6065e^{-1^2/2}=e^{-0.5}\approx0.6065
  3. 3

    Normalization

    0.6065/2π≈0.24200.6065/\sqrt{2\pi}\approx0.2420

Result: Density at x=1 is approximately 0.242. A density value is not itself an event probability.

Sanity check

Checks
  • Σ must be symmetric positive definite for the inverse and positive density to be stably defined.
  • Obtain probabilities through interval integration, distinct from pointwise density.

Symbols

Symbols used in this equation
SymbolMeaning
σ\sigmaStandard deviation or sigmoid notation
κ\kappaA kernel returning similarity between two inputs
N\mathcal{N}Gaussian distribution

Reference-quality follow-up

Explore this calculation further
PDF p. 7 · 2.5 Support vector machine Identifier: MAI-P2-048

The notation N(x;μ,Σ)\mathcal{N}(x;\mu,\Sigma) denotes a normal density with mean μ and covariance Σ.

x10.5
The footnote on PDF p. 6 continues into the unnumbered graph at the top of p. 7. Output lies in (0,1), with value 0.5 at x=0.

#2.6 Minimum-distance classifiers: deterministic classification

A minimum-distance classifier calculates distance from a pattern vector to each class prototype and assigns the nearest prototype’s class.

Prototypes are usually class-mean vectors.

Source equation · PDF p. 7

Minimum-distance classification selects the nearest class representative
mc=1Mc∑x∈Scx,c=1,…,Cm_c=\frac{1}{M_c}\sum_{x\in S_c}x,\qquad c=1,\ldots,C
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which class mean is closest to input x?

Key idea

Calculate class means m_c and compare all distances D_c(x).

Formula-specific lesson

Prototypes, distances, and perpendicular-bisector boundaries

Calculate class means m_c, query Euclidean distances, and discriminants together to verify equivalent decisions and midpoint boundaries.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate class representatives

    mc=1Mc∑x∈Scxm_c=\frac{1}{M_c}\sum_{x\in S_c}x
  2. 2

    Subtract representatives from the input

    rc=x−mcr_c=x-m_c
  3. 3

    Calculate squared distance

    Dc(x)=∥rc∥22D_c(x)=\lVert r_c\rVert_2^2
  4. 4

    Choose the class with smallest distance

    c∗=arg⁡min⁡cDc(x)c^*=\arg\min_cD_c(x)

Worked example

Work through the numbers — Two classes in two dimensions

x=(3,2), m₁=(2,2), and m₂=(5,2).

  1. 1

    Distance to class 1

    D1=(3−2)2+(2−2)2=1D_1=(3-2)^2+(2-2)^2=1
  2. 2

    Distance to class 2

    D2=(3−5)2+(2−2)2=4D_2=(3-5)^2+(2-2)^2=4

Result: Since D₁<D₂, assign class 1.

Sanity check

Checks
  • Compare consistently using either distances or squared distances.
  • Differently scaled features may require standardization or Mahalanobis distance.

Symbols

Symbols used in this equation
SymbolMeaning
∑\sumSum over all specified terms
CCTotal class count or a matrix; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 7 · 2.6 Minimum-distance classifier Identifier: MAI-P2-050

M_c counts patterns used for mean c, S_c is pattern class c, and C is the number of classes.

Using Euclidean similarity gives the following distances.

Source equation · PDF p. 8

Minimum-distance classification selects the nearest class representative
Dc(x)=∥x−mc∥2,c=1,…,CD_c(x)=\|x-m_c\|_2,\qquad c=1,\ldots,C
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which class mean is closest to input x?

Key idea

Calculate class means m_c and compare all distances D_c(x).

Formula-specific lesson

Prototypes, distances, and perpendicular-bisector boundaries

Calculate class means m_c, query Euclidean distances, and discriminants together to verify equivalent decisions and midpoint boundaries.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate class representatives

    mc=1Mc∑x∈Scxm_c=\frac{1}{M_c}\sum_{x\in S_c}x
  2. 2

    Subtract representatives from the input

    rc=x−mcr_c=x-m_c
  3. 3

    Calculate squared distance

    Dc(x)=∥rc∥22D_c(x)=\lVert r_c\rVert_2^2
  4. 4

    Choose the class with smallest distance

    c∗=arg⁡min⁡cDc(x)c^*=\arg\min_cD_c(x)

Worked example

Work through the numbers — Two classes in two dimensions

x=(3,2), m₁=(2,2), and m₂=(5,2).

  1. 1

    Distance to class 1

    D1=(3−2)2+(2−2)2=1D_1=(3-2)^2+(2-2)^2=1
  2. 2

    Distance to class 2

    D2=(3−5)2+(2−2)2=4D_2=(3-5)^2+(2-2)^2=4

Result: Since D₁<D₂, assign class 1.

Sanity check

Checks
  • Compare consistently using either distances or squared distances.
  • Differently scaled features may require standardization or Mahalanobis distance.

Symbols

Symbols used in this equation
SymbolMeaning
CCTotal class count or a matrix; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 8 · 2.6 Minimum-distance classifier Identifier: MAI-P2-051

Assign x to the class whose distance is smaller than every other class’s.

Source equation · PDF p. 8

Minimum-distance classification selects the nearest class representative
Dc(x)<Dc′(x),c′≠cD_c(x)<D_{c\prime}(x),\qquad c\prime\ne c
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which class mean is closest to input x?

Key idea

Calculate class means m_c and compare all distances D_c(x).

Formula-specific lesson

Prototypes, distances, and perpendicular-bisector boundaries

Calculate class means m_c, query Euclidean distances, and discriminants together to verify equivalent decisions and midpoint boundaries.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate class representatives

    mc=1Mc∑x∈Scxm_c=\frac{1}{M_c}\sum_{x\in S_c}x
  2. 2

    Subtract representatives from the input

    rc=x−mcr_c=x-m_c
  3. 3

    Calculate squared distance

    Dc(x)=∥rc∥22D_c(x)=\lVert r_c\rVert_2^2
  4. 4

    Choose the class with smallest distance

    c∗=arg⁡min⁡cDc(x)c^*=\arg\min_cD_c(x)

Worked example

Work through the numbers — Two classes in two dimensions

x=(3,2), m₁=(2,2), and m₂=(5,2).

  1. 1

    Distance to class 1

    D1=(3−2)2+(2−2)2=1D_1=(3-2)^2+(2-2)^2=1
  2. 2

    Distance to class 2

    D2=(3−5)2+(2−2)2=4D_2=(3-5)^2+(2-2)^2=4

Result: Since D₁<D₂, assign class 1.

Sanity check

Checks
  • Compare consistently using either distances or squared distances.
  • Differently scaled features may require standardization or Mahalanobis distance.

Reference-quality follow-up

Explore this calculation further
PDF p. 8 · 2.6 Minimum-distance classifier Identifier: MAI-P2-052

Ties with Dc(x)=Dc′(x)D_c(x)=D_{c\prime}(x) are resolved arbitrarily.

Minimizing distance is equivalent to maximizing the following discriminant.

Source equation · PDF p. 8 · Eq. (2)

Minimum-distance classification selects the nearest class representative
dc(x)=mcTx−12mcTmc,c=1,…,Cd_c(x)=m_c^{\mathsf T}x-\frac{1}{2}m_c^{\mathsf T}m_c,\qquad c=1,\ldots,C
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which class mean is closest to input x?

Key idea

Calculate class means m_c and compare all distances D_c(x).

Formula-specific lesson

Prototypes, distances, and perpendicular-bisector boundaries

Calculate class means m_c, query Euclidean distances, and discriminants together to verify equivalent decisions and midpoint boundaries.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate class representatives

    mc=1Mc∑x∈Scxm_c=\frac{1}{M_c}\sum_{x\in S_c}x
  2. 2

    Subtract representatives from the input

    rc=x−mcr_c=x-m_c
  3. 3

    Calculate squared distance

    Dc(x)=∥rc∥22D_c(x)=\lVert r_c\rVert_2^2
  4. 4

    Choose the class with smallest distance

    c∗=arg⁡min⁡cDc(x)c^*=\arg\min_cD_c(x)

Worked example

Work through the numbers — Two classes in two dimensions

x=(3,2), m₁=(2,2), and m₂=(5,2).

  1. 1

    Distance to class 1

    D1=(3−2)2+(2−2)2=1D_1=(3-2)^2+(2-2)^2=1
  2. 2

    Distance to class 2

    D2=(3−5)2+(2−2)2=4D_2=(3-5)^2+(2-2)^2=4

Result: Since D₁<D₂, assign class 1.

Sanity check

Checks
  • Compare consistently using either distances or squared distances.
  • Differently scaled features may require standardization or Mahalanobis distance.

Symbols

Symbols used in this equation
SymbolMeaning
CCTotal class count or a matrix; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 8 · Eq. (2) · 2.6 Minimum-distance classifier Identifier: MAI-P2-054

Source equation · PDF p. 8

Minimum-distance classification selects the nearest class representative
dc(x)>dc′(x),c′≠cd_c(x)>d_{c\prime}(x),\qquad c\prime\ne c
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which class mean is closest to input x?

Key idea

Calculate class means m_c and compare all distances D_c(x).

Formula-specific lesson

Prototypes, distances, and perpendicular-bisector boundaries

Calculate class means m_c, query Euclidean distances, and discriminants together to verify equivalent decisions and midpoint boundaries.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate class representatives

    mc=1Mc∑x∈Scxm_c=\frac{1}{M_c}\sum_{x\in S_c}x
  2. 2

    Subtract representatives from the input

    rc=x−mcr_c=x-m_c
  3. 3

    Calculate squared distance

    Dc(x)=∥rc∥22D_c(x)=\lVert r_c\rVert_2^2
  4. 4

    Choose the class with smallest distance

    c∗=arg⁡min⁡cDc(x)c^*=\arg\min_cD_c(x)

Worked example

Work through the numbers — Two classes in two dimensions

x=(3,2), m₁=(2,2), and m₂=(5,2).

  1. 1

    Distance to class 1

    D1=(3−2)2+(2−2)2=1D_1=(3-2)^2+(2-2)^2=1
  2. 2

    Distance to class 2

    D2=(3−5)2+(2−2)2=4D_2=(3-5)^2+(2-2)^2=4

Result: Since D₁<D₂, assign class 1.

Sanity check

Checks
  • Compare consistently using either distances or squared distances.
  • Differently scaled features may require standardization or Mahalanobis distance.

Reference-quality follow-up

Explore this calculation further
PDF p. 8 · 2.6 Minimum-distance classifier Identifier: MAI-P2-055

In recognition, this is called a decision or discriminant function.

A two-class boundary contains x where their discriminants agree.

Source equation · PDF p. 8 · Eq. (3)

Minimum-distance classification selects the nearest class representative
dc(x)=dc′(x)d_c(x)=d_{c\prime}(x)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which class mean is closest to input x?

Key idea

Calculate class means m_c and compare all distances D_c(x).

Formula-specific lesson

Prototypes, distances, and perpendicular-bisector boundaries

Calculate class means m_c, query Euclidean distances, and discriminants together to verify equivalent decisions and midpoint boundaries.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate class representatives

    mc=1Mc∑x∈Scxm_c=\frac{1}{M_c}\sum_{x\in S_c}x
  2. 2

    Subtract representatives from the input

    rc=x−mcr_c=x-m_c
  3. 3

    Calculate squared distance

    Dc(x)=∥rc∥22D_c(x)=\lVert r_c\rVert_2^2
  4. 4

    Choose the class with smallest distance

    c∗=arg⁡min⁡cDc(x)c^*=\arg\min_cD_c(x)

Worked example

Work through the numbers — Two classes in two dimensions

x=(3,2), m₁=(2,2), and m₂=(5,2).

  1. 1

    Distance to class 1

    D1=(3−2)2+(2−2)2=1D_1=(3-2)^2+(2-2)^2=1
  2. 2

    Distance to class 2

    D2=(3−5)2+(2−2)2=4D_2=(3-5)^2+(2-2)^2=4

Result: Since D₁<D₂, assign class 1.

Sanity check

Checks
  • Compare consistently using either distances or squared distances.
  • Differently scaled features may require standardization or Mahalanobis distance.

Reference-quality follow-up

Explore this calculation further
PDF p. 8 · Eq. (3) · 2.6 Minimum-distance classifier Identifier: MAI-P2-056

Source equation · PDF p. 8

Minimum-distance classification selects the nearest class representative
dc,c′(x)=dc(x)−dc′(x)=(mc−mc′)Tx−12(mc−mc′)T(mc+mc′)=0d_{c,c\prime}(x)=d_c(x)-d_{c\prime}(x)=(m_c-m_{c\prime})^{\mathsf T}x-\frac{1}{2}(m_c-m_{c\prime})^{\mathsf T}(m_c+m_{c\prime})=0
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which class mean is closest to input x?

Key idea

Calculate class means m_c and compare all distances D_c(x).

Formula-specific lesson

Prototypes, distances, and perpendicular-bisector boundaries

Calculate class means m_c, query Euclidean distances, and discriminants together to verify equivalent decisions and midpoint boundaries.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate class representatives

    mc=1Mc∑x∈Scxm_c=\frac{1}{M_c}\sum_{x\in S_c}x
  2. 2

    Subtract representatives from the input

    rc=x−mcr_c=x-m_c
  3. 3

    Calculate squared distance

    Dc(x)=∥rc∥22D_c(x)=\lVert r_c\rVert_2^2
  4. 4

    Choose the class with smallest distance

    c∗=arg⁡min⁡cDc(x)c^*=\arg\min_cD_c(x)

Worked example

Work through the numbers — Two classes in two dimensions

x=(3,2), m₁=(2,2), and m₂=(5,2).

  1. 1

    Distance to class 1

    D1=(3−2)2+(2−2)2=1D_1=(3-2)^2+(2-2)^2=1
  2. 2

    Distance to class 2

    D2=(3−5)2+(2−2)2=4D_2=(3-5)^2+(2-2)^2=4

Result: Since D₁<D₂, assign class 1.

Sanity check

Checks
  • Compare consistently using either distances or squared distances.
  • Differently scaled features may require standardization or Mahalanobis distance.

Reference-quality follow-up

Explore this calculation further
PDF p. 8 · 2.6 Minimum-distance classifier Identifier: MAI-P2-057

It is the perpendicular bisector of the segment joining m_c and m_c′: a line for {mc∈R2:∀c}\{m_c\in\mathbb{R}^2:\forall c\}, a plane for {mc∈R3:∀c}\{m_c\in\mathbb{R}^3:\forall c\}, and a hyperplane in higher dimensions.

#2.7 Bayes classifiers: statistical classification

Since pattern classes arise from random processes, probabilities matter. This section derives a rule minimizing average classification-error probability.

#2.7.1 Bayes classifiers for arbitrary pattern classes

The quantity P(Sc∣x)P(S_c\mid x) is the posterior probability that x came from S_c; L(ac∣Sc′)L(a_c\mid S_{c\prime}) is the loss of action a_c when the true class is S_c′.

The usual 0–1 loss gives zero for correct decisions and the same unit loss of one for mistakes.

Source equation · PDF p. 8 · Eq. (4)

Conditional risk averages possible true-class losses under posterior probabilities
L(ac∣Sc′)={0,c=c′,1,c≠c′,c,c′=1,…,CL(a_c\mid S_{c\prime})=\begin{cases}0,&c=c\prime,\\1,&c\ne c\prime,\end{cases}\qquad c,c\prime=1,\ldots,C
Explanation and calculations 5 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which action minimizes mean loss for the current observation?

Key idea

For each action, sum true-class loss times posterior probability, then choose the smallest risk.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Structure explanation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose a candidate action

    aca_c
  2. 2

    List losses for each possible true class

    L(ac∣Sj)L(a_c\mid S_j)
  3. 3

    Multiply each loss by its posterior probability

    L(ac∣Sj)P(Sj∣x)L(a_c\mid S_j)P(S_j\mid x)
  4. 4

    Sum across all classes

    Rc(x)=∑jL(ac∣Sj)P(Sj∣x)R_c(x)=\sum_jL(a_c\mid S_j)P(S_j\mid x)
  5. 5

    Select minimum risk

    c∗=arg⁡min⁡cRc(x)c^*=\arg\min_cR_c(x)

Worked example

Work through the numbers — Two classes with 0–1 loss

P(S₁|x)=0.7 and P(S₂|x)=0.3.

  1. 1

    Risk of choosing S₁

    R1=0(0.7)+1(0.3)=0.3R_1=0(0.7)+1(0.3)=0.3
  2. 2

    Risk of choosing S₂

    R2=1(0.7)+0(0.3)=0.7R_2=1(0.7)+0(0.3)=0.7

Result: Since R₁<R₂, choose S₁.

Sanity check

Checks
  • Specify the meanings of loss-matrix rows and columns first.
  • With asymmetric costs, the most probable class may differ from the minimum-risk decision.

Symbols

Symbols used in this equation
SymbolMeaning
CCTotal class count or a matrix; check context
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 8 · Eq. (4) · 2.7.1 Bayes classifier Identifier: MAI-P2-062

Conditional mean risk averages the loss of assigning x to a class under posterior probabilities.

Source equation · PDF p. 8 · Eq. (5)

Bayes' rule normalizes likelihood times prior by total evidence
Rc′(x)=∑c=1CL(ac∣Sc′)P(Sc∣x),c′=1,…,CR_{c\prime}(x)=\sum_{c=1}^{C}L(a_c\mid S_{c\prime})P(S_c\mid x),\qquad c\prime=1,\ldots,C
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
∑\sumSum over all specified terms
P(⋅)P(\cdot)Event probability
CCTotal class count or a matrix; check context
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 8 · Eq. (5) · 2.7.1 Bayes classifier Identifier: MAI-P2-063

#Bayes’ rule, priors, and class-conditional densities

Source equation · PDF p. 9

Bayes' rule normalizes likelihood times prior by total evidence
P(X∣Y)=P(Y∣X)P(X)P(Y)P(X\mid Y)=\frac{P(Y\mid X)P(X)}{P(Y)}
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · 2.7.1 Bayes classifier Identifier: MAI-P2-064

In words: posterior = likelihood × prior / evidence. P(S_c) is class probability before observation, P(S_c|x) the posterior afterward, and p(x|S_c) the class-conditional density.

Source equation · PDF p. 9

Bayes' rule normalizes likelihood times prior by total evidence
P(Sc,x)=P(Sc∣x)p(x)=p(x∣Sc)P(Sc)P(S_c,x)=P(S_c\mid x)p(x)=p(x\mid S_c)P(S_c)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · 2.7.1 Bayes classifier Identifier: MAI-P2-065

The source leaves equation (6) blank for students to complete the posterior.

Source equation · PDF p. 9 · Eq. (6)

Bayes' rule normalizes likelihood times prior by total evidence
P(Sc∣x)=??P(S_c\mid x)=\boxed{\text{??}}
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Structure explanation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · Eq. (6) · 2.7.1 Bayes classifier Identifier: MAI-P2-066

#Bayes classifier

Substituting equation (6) into risk produces the common positive factor 1/p(x).

Source equation · PDF p. 9

Bayes' rule normalizes likelihood times prior by total evidence
Rc′(x)=1p(x)∑c=1CL(ac∣Sc′)p(x∣Sc)P(Sc)R_{c\prime}(x)=\frac{1}{p(x)}\sum_{c=1}^{C}L(a_c\mid S_{c\prime})p(x\mid S_c)P(S_c)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
∑\sumSum over all specified terms
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density
CCTotal class count or a matrix; check context
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · 2.7.1 Bayes classifier Identifier: MAI-P2-068

Because it is positive and shared across candidate risks, removing it does not change the minimum-risk class.

Source equation · PDF p. 9 · Eq. (7)

Bayes' rule normalizes likelihood times prior by total evidence
Rc′(x)=∑c=1CL(ac∣Sc′)p(x∣Sc)P(Sc),c′=1,…,CR_{c\prime}(x)=\sum_{c=1}^{C}L(a_c\mid S_{c\prime})p(x\mid S_c)P(S_c),\qquad c\prime=1,\ldots,C
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
∑\sumSum over all specified terms
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density
CCTotal class count or a matrix; check context
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · Eq. (7) · 2.7.1 Bayes classifier Identifier: MAI-P2-069

Calculating risks at each x and selecting the smallest minimizes overall mean risk.

Source equation · PDF p. 9

Conditional risk averages possible true-class losses under posterior probabilities
Rc(x)<Rc′(x),c′≠cR_c(x)<R_{c\prime}(x),\qquad c\prime\ne c
Explanation and calculations 5 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which action minimizes mean loss for the current observation?

Key idea

For each action, sum true-class loss times posterior probability, then choose the smallest risk.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose a candidate action

    aca_c
  2. 2

    List losses for each possible true class

    L(ac∣Sj)L(a_c\mid S_j)
  3. 3

    Multiply each loss by its posterior probability

    L(ac∣Sj)P(Sj∣x)L(a_c\mid S_j)P(S_j\mid x)
  4. 4

    Sum across all classes

    Rc(x)=∑jL(ac∣Sj)P(Sj∣x)R_c(x)=\sum_jL(a_c\mid S_j)P(S_j\mid x)
  5. 5

    Select minimum risk

    c∗=arg⁡min⁡cRc(x)c^*=\arg\min_cR_c(x)

Worked example

Work through the numbers — Two classes with 0–1 loss

P(S₁|x)=0.7 and P(S₂|x)=0.3.

  1. 1

    Risk of choosing S₁

    R1=0(0.7)+1(0.3)=0.3R_1=0(0.7)+1(0.3)=0.3
  2. 2

    Risk of choosing S₂

    R2=1(0.7)+0(0.3)=0.7R_2=1(0.7)+0(0.3)=0.7

Result: Since R₁<R₂, choose S₁.

Sanity check

Checks
  • Specify the meanings of loss-matrix rows and columns first.
  • With asymmetric costs, the most probable class may differ from the minimum-risk decision.

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · 2.7.1 Bayes classifier Identifier: MAI-P2-070

#Bayes classifier with 0–1 loss

Source equation · PDF p. 9

Conditional risk averages possible true-class losses under posterior probabilities
L(ac∣Sc′)=1−δc,c′L(a_c\mid S_{c\prime})=1-\delta_{c,c\prime}
Explanation and calculations 5 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which action minimizes mean loss for the current observation?

Key idea

For each action, sum true-class loss times posterior probability, then choose the smallest risk.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Structure explanation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose a candidate action

    aca_c
  2. 2

    List losses for each possible true class

    L(ac∣Sj)L(a_c\mid S_j)
  3. 3

    Multiply each loss by its posterior probability

    L(ac∣Sj)P(Sj∣x)L(a_c\mid S_j)P(S_j\mid x)
  4. 4

    Sum across all classes

    Rc(x)=∑jL(ac∣Sj)P(Sj∣x)R_c(x)=\sum_jL(a_c\mid S_j)P(S_j\mid x)
  5. 5

    Select minimum risk

    c∗=arg⁡min⁡cRc(x)c^*=\arg\min_cR_c(x)

Worked example

Work through the numbers — Two classes with 0–1 loss

P(S₁|x)=0.7 and P(S₂|x)=0.3.

  1. 1

    Risk of choosing S₁

    R1=0(0.7)+1(0.3)=0.3R_1=0(0.7)+1(0.3)=0.3
  2. 2

    Risk of choosing S₂

    R2=1(0.7)+0(0.3)=0.7R_2=1(0.7)+0(0.3)=0.7

Result: Since R₁<R₂, choose S₁.

Sanity check

Checks
  • Specify the meanings of loss-matrix rows and columns first.
  • With asymmetric costs, the most probable class may differ from the minimum-risk decision.

Symbols

Symbols used in this equation
SymbolMeaning
LLSample count or loss function; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · 2.7.1 Bayes classifier Identifier: MAI-P2-071
δc,c′=1if c=c′\delta_{c,c\prime}=1\quad\text{if }c=c\prime δc,c′=0if c≠c′\delta_{c,c\prime}=0\quad\text{if }c\ne c\prime

Substituting into equation (7) gives this sum.

Source equation · PDF p. 9

Bayes' rule normalizes likelihood times prior by total evidence
Rc′(x)=∑c=1C(1−δc,c′)p(x∣Sc)P(Sc)R_{c\prime}(x)=\sum_{c=1}^{C}(1-\delta_{c,c\prime})p(x\mid S_c)P(S_c)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
∑\sumSum over all specified terms
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density
CCTotal class count or a matrix; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · 2.7.1 Bayes classifier Identifier: MAI-P2-074

The source again leaves ?? for simplification using total probability.

Source equation · PDF p. 9

Conditional risk averages possible true-class losses under posterior probabilities
Rc′(x)=??,c′=1,…,CR_{c\prime}(x)=\boxed{\text{??}},\qquad c\prime=1,\ldots,C
Explanation and calculations 5 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which action minimizes mean loss for the current observation?

Key idea

For each action, sum true-class loss times posterior probability, then choose the smallest risk.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Structure explanation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Choose a candidate action

    aca_c
  2. 2

    List losses for each possible true class

    L(ac∣Sj)L(a_c\mid S_j)
  3. 3

    Multiply each loss by its posterior probability

    L(ac∣Sj)P(Sj∣x)L(a_c\mid S_j)P(S_j\mid x)
  4. 4

    Sum across all classes

    Rc(x)=∑jL(ac∣Sj)P(Sj∣x)R_c(x)=\sum_jL(a_c\mid S_j)P(S_j\mid x)
  5. 5

    Select minimum risk

    c∗=arg⁡min⁡cRc(x)c^*=\arg\min_cR_c(x)

Worked example

Work through the numbers — Two classes with 0–1 loss

P(S₁|x)=0.7 and P(S₂|x)=0.3.

  1. 1

    Risk of choosing S₁

    R1=0(0.7)+1(0.3)=0.3R_1=0(0.7)+1(0.3)=0.3
  2. 2

    Risk of choosing S₂

    R2=1(0.7)+0(0.3)=0.7R_2=1(0.7)+0(0.3)=0.7

Result: Since R₁<R₂, choose S₁.

Sanity check

Checks
  • Specify the meanings of loss-matrix rows and columns first.
  • With asymmetric costs, the most probable class may differ from the minimum-risk decision.

Symbols

Symbols used in this equation
SymbolMeaning
CCTotal class count or a matrix; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · 2.7.1 Bayes classifier Identifier: MAI-P2-075

When risks are compared, the common p(x) cancels.

Source equation · PDF p. 9

Bayes' rule normalizes likelihood times prior by total evidence
p(x)−p(x∣Sc)P(Sc)<p(x)−p(x∣Sc′)P(Sc′)p(x)-p(x\mid S_c)P(S_c)<p(x)-p(x\mid S_{c\prime})P(S_{c\prime})
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · 2.7.1 Bayes classifier Identifier: MAI-P2-077

The equivalent rule selects the greatest product of class-conditional likelihood and prior.

Source equation · PDF p. 9

Bayes' rule normalizes likelihood times prior by total evidence
p(x∣Sc)P(Sc)>p(x∣Sc′)P(Sc′)p(x\mid S_c)P(S_c)>p(x\mid S_{c\prime})P(S_{c\prime})
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · 2.7.1 Bayes classifier Identifier: MAI-P2-078

The discriminant under 0–1 loss is:

Source equation · PDF p. 10 · Eq. (8)

Bayes' rule normalizes likelihood times prior by total evidence
dc(x)=p(x∣Sc)P(Sc),c=1,…,Cd_c(x)=p(x\mid S_c)P(S_c),\qquad c=1,\ldots,C
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density
CCTotal class count or a matrix; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 10 · Eq. (8) · 2.7.1 Bayes classifier Identifier: MAI-P2-079

Maximizing this discriminant minimizes mean classification risk. Claiming optimality, however, requires knowing p(x|S_c) and P(S_c).

  • Equal class frequencies permit P(Sc)=1CP(S_c)=\frac{1}{C}. Otherwise, domain knowledge or sample frequencies can estimate priors.
  • Estimating N-dimensional class-conditional density p(x|S_c) is difficult with few class samples or poorly behaved densities. Practical Bayes classifiers therefore often assume analytical density families.

#2.7.2 Gaussian pattern classes

Assuming a class-conditional distribution family reduces learning to estimating its parameters rather than an entire density. The most common assumption is multivariate Gaussian.

Source equation · PDF p. 10 · Eq. (9)

Gaussian density uses standardized distance from the mean
p(x∣Sc)=1(2π)N/2∣Vc∣1/2exp⁡ ⁣[−12(x−mc)TVc−1(x−mc)]p(x\mid S_c)=\frac{1}{(2\pi)^{N/2}|V_c|^{1/2}}\exp\!\left[-\frac{1}{2}(x-m_c)^{\mathsf T}V_c^{-1}(x-m_c)\right]
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How plausible is observation x under mean μ and covariance Σ?

Key idea

Calculate a covariance-scaled distance from the mean and a normalization constant to obtain density.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Structure explanation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference from the mean

    r=x−μr=x-\mu
  2. 2

    Adjust distance using variance or covariance

    d2=rTΣ−1rd^2=r^T\Sigma^{-1}r
  3. 3

    Calculate exponential decay

    exp⁡(−d2/2)\exp(-d^2/2)
  4. 4

    Divide by the normalization constant

    (2π)N/2∣Σ∣1/2(2\pi)^{N/2}|\Sigma|^{1/2}

Worked example

Work through the numbers — x=1 under a standard normal

A one-dimensional Gaussian with μ=0 and σ=1.

  1. 1

    Standardized distance

    z=(1−0)/1=1z=(1-0)/1=1
  2. 2

    Exponential term

    e−12/2=e−0.5≈0.6065e^{-1^2/2}=e^{-0.5}\approx0.6065
  3. 3

    Normalization

    0.6065/2π≈0.24200.6065/\sqrt{2\pi}\approx0.2420

Result: Density at x=1 is approximately 0.242. A density value is not itself an event probability.

Sanity check

Checks
  • Σ must be symmetric positive definite for the inverse and positive density to be stably defined.
  • Obtain probabilities through interval integration, distinct from pointwise density.

Symbols

Symbols used in this equation
SymbolMeaning
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 10 · Eq. (9) · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-081

A mean vector and covariance matrix fully specify each density.

Source equation · PDF p. 10

Gaussian density uses standardized distance from the mean
mc=E[x∣Sc]m_c=\mathbb{E}[x\mid S_c]
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How plausible is observation x under mean μ and covariance Σ?

Key idea

Calculate a covariance-scaled distance from the mean and a normalization constant to obtain density.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference from the mean

    r=x−μr=x-\mu
  2. 2

    Adjust distance using variance or covariance

    d2=rTΣ−1rd^2=r^T\Sigma^{-1}r
  3. 3

    Calculate exponential decay

    exp⁡(−d2/2)\exp(-d^2/2)
  4. 4

    Divide by the normalization constant

    (2π)N/2∣Σ∣1/2(2\pi)^{N/2}|\Sigma|^{1/2}

Worked example

Work through the numbers — x=1 under a standard normal

A one-dimensional Gaussian with μ=0 and σ=1.

  1. 1

    Standardized distance

    z=(1−0)/1=1z=(1-0)/1=1
  2. 2

    Exponential term

    e−12/2=e−0.5≈0.6065e^{-1^2/2}=e^{-0.5}\approx0.6065
  3. 3

    Normalization

    0.6065/2π≈0.24200.6065/\sqrt{2\pi}\approx0.2420

Result: Density at x=1 is approximately 0.242. A density value is not itself an event probability.

Sanity check

Checks
  • Σ must be symmetric positive definite for the inverse and positive density to be stably defined.
  • Obtain probabilities through interval integration, distinct from pointwise density.

Symbols

Symbols used in this equation
SymbolMeaning
E\mathbb{E}Expectation: the probability-weighted average of possible values

Reference-quality follow-up

Explore this calculation further
PDF p. 10 · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-082

Source equation · PDF p. 10

Gaussian density uses standardized distance from the mean
Vc=E ⁣[(x−mc)(x−mc)T∣Sc]V_c=\mathbb{E}\!\left[(x-m_c)(x-m_c)^{\mathsf T}\mid S_c\right]
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How plausible is observation x under mean μ and covariance Σ?

Key idea

Calculate a covariance-scaled distance from the mean and a normalization constant to obtain density.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference from the mean

    r=x−μr=x-\mu
  2. 2

    Adjust distance using variance or covariance

    d2=rTΣ−1rd^2=r^T\Sigma^{-1}r
  3. 3

    Calculate exponential decay

    exp⁡(−d2/2)\exp(-d^2/2)
  4. 4

    Divide by the normalization constant

    (2π)N/2∣Σ∣1/2(2\pi)^{N/2}|\Sigma|^{1/2}

Worked example

Work through the numbers — x=1 under a standard normal

A one-dimensional Gaussian with μ=0 and σ=1.

  1. 1

    Standardized distance

    z=(1−0)/1=1z=(1-0)/1=1
  2. 2

    Exponential term

    e−12/2=e−0.5≈0.6065e^{-1^2/2}=e^{-0.5}\approx0.6065
  3. 3

    Normalization

    0.6065/2π≈0.24200.6065/\sqrt{2\pi}\approx0.2420

Result: Density at x=1 is approximately 0.242. A density value is not itself an event probability.

Sanity check

Checks
  • Σ must be symmetric positive definite for the inverse and positive density to be stably defined.
  • Obtain probabilities through interval integration, distinct from pointwise density.

Symbols

Symbols used in this equation
SymbolMeaning
E\mathbb{E}Expectation: the probability-weighted average of possible values

Reference-quality follow-up

Explore this calculation further
PDF p. 10 · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-083

Approximating expectations by sample averages gives these estimators.

Source equation · PDF p. 10

Gaussian density uses standardized distance from the mean
mc=1Mc∑x∈Scxm_c=\frac{1}{M_c}\sum_{x\in S_c}x
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How plausible is observation x under mean μ and covariance Σ?

Key idea

Calculate a covariance-scaled distance from the mean and a normalization constant to obtain density.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference from the mean

    r=x−μr=x-\mu
  2. 2

    Adjust distance using variance or covariance

    d2=rTΣ−1rd^2=r^T\Sigma^{-1}r
  3. 3

    Calculate exponential decay

    exp⁡(−d2/2)\exp(-d^2/2)
  4. 4

    Divide by the normalization constant

    (2π)N/2∣Σ∣1/2(2\pi)^{N/2}|\Sigma|^{1/2}

Worked example

Work through the numbers — x=1 under a standard normal

A one-dimensional Gaussian with μ=0 and σ=1.

  1. 1

    Standardized distance

    z=(1−0)/1=1z=(1-0)/1=1
  2. 2

    Exponential term

    e−12/2=e−0.5≈0.6065e^{-1^2/2}=e^{-0.5}\approx0.6065
  3. 3

    Normalization

    0.6065/2π≈0.24200.6065/\sqrt{2\pi}\approx0.2420

Result: Density at x=1 is approximately 0.242. A density value is not itself an event probability.

Sanity check

Checks
  • Σ must be symmetric positive definite for the inverse and positive density to be stably defined.
  • Obtain probabilities through interval integration, distinct from pointwise density.

Symbols

Symbols used in this equation
SymbolMeaning
∑\sumSum over all specified terms

Reference-quality follow-up

Explore this calculation further
PDF p. 10 · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-084

Source equation · PDF p. 10

Gaussian density uses standardized distance from the mean
Vc=1Mc∑x∈ScxxT−mcmcTV_c=\frac{1}{M_c}\sum_{x\in S_c}xx^{\mathsf T}-m_cm_c^{\mathsf T}
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How plausible is observation x under mean μ and covariance Σ?

Key idea

Calculate a covariance-scaled distance from the mean and a normalization constant to obtain density.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference from the mean

    r=x−μr=x-\mu
  2. 2

    Adjust distance using variance or covariance

    d2=rTΣ−1rd^2=r^T\Sigma^{-1}r
  3. 3

    Calculate exponential decay

    exp⁡(−d2/2)\exp(-d^2/2)
  4. 4

    Divide by the normalization constant

    (2π)N/2∣Σ∣1/2(2\pi)^{N/2}|\Sigma|^{1/2}

Worked example

Work through the numbers — x=1 under a standard normal

A one-dimensional Gaussian with μ=0 and σ=1.

  1. 1

    Standardized distance

    z=(1−0)/1=1z=(1-0)/1=1
  2. 2

    Exponential term

    e−12/2=e−0.5≈0.6065e^{-1^2/2}=e^{-0.5}\approx0.6065
  3. 3

    Normalization

    0.6065/2π≈0.24200.6065/\sqrt{2\pi}\approx0.2420

Result: Density at x=1 is approximately 0.242. A density value is not itself an event probability.

Sanity check

Checks
  • Σ must be symmetric positive definite for the inverse and positive density to be stably defined.
  • Obtain probabilities through interval integration, distinct from pointwise density.

Symbols

Symbols used in this equation
SymbolMeaning
∑\sumSum over all specified terms

Reference-quality follow-up

Explore this calculation further
PDF p. 10 · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-085

The source’s covariance denominator 1/M_c is a maximum-likelihood-style sample moment, distinct from the unbiased estimator’s 1/(M_c−1).

The example uses N=1,C=2N=1,\qquad C=2, class means m₁,m₂, and standard deviations σ₁,σ₂.

The one-dimensional Gaussian discriminant is printed at the source page’s bottom as follows.

Source notation requires review · PDF p. 10

Bayes' rule normalizes likelihood times prior by total evidence
dc(x)=p(x∣Sc)P(Sc)=12πσcexp⁡ ⁣[−x−mc2σc2]P(Sc),c=1,2d_c(x)=p(x\mid S_c)P(S_c)=\frac{1}{\sqrt{2\pi}\sigma_c}\exp\!\left[-\frac{x-m_c}{2\sigma_c^2}\right]P(S_c),\qquad c=1,2
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Structure explanation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
σ\sigmaStandard deviation or sigmoid notation
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 10 · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-087

Source exercise ??: sketch both classes’ one-dimensional densities.

Their boundary is a point x₀ where discriminant values agree.

Source equation · PDF p. 11

Gaussian density uses standardized distance from the mean
d1(x0)=d2(x0)d_1(x_0)=d_2(x_0)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How plausible is observation x under mean μ and covariance Σ?

Key idea

Calculate a covariance-scaled distance from the mean and a normalization constant to obtain density.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference from the mean

    r=x−μr=x-\mu
  2. 2

    Adjust distance using variance or covariance

    d2=rTΣ−1rd^2=r^T\Sigma^{-1}r
  3. 3

    Calculate exponential decay

    exp⁡(−d2/2)\exp(-d^2/2)
  4. 4

    Divide by the normalization constant

    (2π)N/2∣Σ∣1/2(2\pi)^{N/2}|\Sigma|^{1/2}

Worked example

Work through the numbers — x=1 under a standard normal

A one-dimensional Gaussian with μ=0 and σ=1.

  1. 1

    Standardized distance

    z=(1−0)/1=1z=(1-0)/1=1
  2. 2

    Exponential term

    e−12/2=e−0.5≈0.6065e^{-1^2/2}=e^{-0.5}\approx0.6065
  3. 3

    Normalization

    0.6065/2π≈0.24200.6065/\sqrt{2\pi}\approx0.2420

Result: Density at x=1 is approximately 0.242. A density value is not itself an event probability.

Sanity check

Checks
  • Σ must be symmetric positive definite for the inverse and positive density to be stably defined.
  • Obtain probabilities through interval integration, distinct from pointwise density.

Reference-quality follow-up

Explore this calculation further
PDF p. 11 · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-089

For equally frequent classes:

Source equation · PDF p. 11

Bayes' rule normalizes likelihood times prior by total evidence
P(S1)=P(S2)=12P(S_1)=P(S_2)=\frac{1}{2}
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Structure explanation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability

Reference-quality follow-up

Explore this calculation further
PDF p. 11 · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-090

The decision boundary lies at the density curves’ intersection.

Source equation · PDF p. 11

Gaussian density uses standardized distance from the mean
p(x0∣S1)=p(x0∣S2)p(x_0\mid S_1)=p(x_0\mid S_2)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How plausible is observation x under mean μ and covariance Σ?

Key idea

Calculate a covariance-scaled distance from the mean and a normalization constant to obtain density.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference from the mean

    r=x−μr=x-\mu
  2. 2

    Adjust distance using variance or covariance

    d2=rTΣ−1rd^2=r^T\Sigma^{-1}r
  3. 3

    Calculate exponential decay

    exp⁡(−d2/2)\exp(-d^2/2)
  4. 4

    Divide by the normalization constant

    (2π)N/2∣Σ∣1/2(2\pi)^{N/2}|\Sigma|^{1/2}

Worked example

Work through the numbers — x=1 under a standard normal

A one-dimensional Gaussian with μ=0 and σ=1.

  1. 1

    Standardized distance

    z=(1−0)/1=1z=(1-0)/1=1
  2. 2

    Exponential term

    e−12/2=e−0.5≈0.6065e^{-1^2/2}=e^{-0.5}\approx0.6065
  3. 3

    Normalization

    0.6065/2π≈0.24200.6065/\sqrt{2\pi}\approx0.2420

Result: Density at x=1 is approximately 0.242. A density value is not itself an event probability.

Sanity check

Checks
  • Σ must be symmetric positive definite for the inverse and positive density to be stably defined.
  • Obtain probabilities through interval integration, distinct from pointwise density.

Symbols

Symbols used in this equation
SymbolMeaning
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 11 · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-091

Taking a monotone increasing logarithm simplifies Gaussian exponentials.

Source equation · PDF p. 11 · Eq. (10)

Bayes' rule normalizes likelihood times prior by total evidence
dc(x)=ln⁡ ⁣(p(x∣Sc)P(Sc))=ln⁡p(x∣Sc)+ln⁡P(Sc)d_c(x)=\ln\!\big(p(x\mid S_c)P(S_c)\big)=\ln p(x\mid S_c)+\ln P(S_c)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 11 · Eq. (10) · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-092

Source equation · PDF p. 11

Bayes' rule normalizes likelihood times prior by total evidence
dc(x)=ln⁡P(Sc)−N2ln⁡(2π)−12ln⁡∣Vc∣−12(x−mc)TVc−1(x−mc)d_c(x)=\ln P(S_c)-\frac{N}{2}\ln(2\pi)-\frac{1}{2}\ln|V_c|-\frac{1}{2}(x-m_c)^{\mathsf T}V_c^{-1}(x-m_c)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability

Reference-quality follow-up

Explore this calculation further
PDF p. 11 · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-093

Removing the class-independent −N/2 ln(2π) term gives the Gaussian discriminant under 0–1 loss.

Source equation · PDF p. 11 · Eq. (11)

Bayes' rule normalizes likelihood times prior by total evidence
dc(x)=ln⁡P(Sc)−12ln⁡∣Vc∣−12(x−mc)TVc−1(x−mc),c=1,…,Cd_c(x)=\ln P(S_c)-\frac{1}{2}\ln|V_c|-\frac{1}{2}(x-m_c)^{\mathsf T}V_c^{-1}(x-m_c),\qquad c=1,\ldots,C
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability
CCTotal class count or a matrix; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 11 · Eq. (11) · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-094

This is a quadratic function, or hyperquadric, in N-dimensional space. For Gaussian classes, pairwise quadratic decision boundaries achieve the Bayes classifier’s minimum mean risk.

If all covariances agree, {Vc=V:c=1,…,C}\{V_c=V:c=1,\ldots,C\}, class-independent terms can be removed.

Source equation · PDF p. 11 · Eq. (12)

Bayes' rule normalizes likelihood times prior by total evidence
dc(x)=ln⁡P(Sc)+xTV−1mc−12mcTV−1mc,c=1,…,Cd_c(x)=\ln P(S_c)+x^{\mathsf T}V^{-1}m_c-\frac{1}{2}m_c^{\mathsf T}V^{-1}m_c,\qquad c=1,\ldots,C
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability
CCTotal class count or a matrix; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 11 · Eq. (12) · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-096

The resulting discriminants and class boundaries are linear hyperplanes.

Further, if V=IV=I and every class has prior P(Sc)=1C,c=1,…,CP(S_c)=\frac{1}{C},\qquad c=1,\ldots,C, the common prior term disappears too.

Source equation · PDF p. 11

Gaussian density uses standardized distance from the mean
dc(x)=xTmc−12mcTmc,c=1,…,Cd_c(x)=x^{\mathsf T}m_c-\frac{1}{2}m_c^{\mathsf T}m_c,\qquad c=1,\ldots,C
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

How plausible is observation x under mean μ and covariance Σ?

Key idea

Calculate a covariance-scaled distance from the mean and a normalization constant to obtain density.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Synchronized derivation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Calculate the difference from the mean

    r=x−μr=x-\mu
  2. 2

    Adjust distance using variance or covariance

    d2=rTΣ−1rd^2=r^T\Sigma^{-1}r
  3. 3

    Calculate exponential decay

    exp⁡(−d2/2)\exp(-d^2/2)
  4. 4

    Divide by the normalization constant

    (2π)N/2∣Σ∣1/2(2\pi)^{N/2}|\Sigma|^{1/2}

Worked example

Work through the numbers — x=1 under a standard normal

A one-dimensional Gaussian with μ=0 and σ=1.

  1. 1

    Standardized distance

    z=(1−0)/1=1z=(1-0)/1=1
  2. 2

    Exponential term

    e−12/2=e−0.5≈0.6065e^{-1^2/2}=e^{-0.5}\approx0.6065
  3. 3

    Normalization

    0.6065/2π≈0.24200.6065/\sqrt{2\pi}\approx0.2420

Result: Density at x=1 is approximately 0.242. A density value is not itself an event probability.

Sanity check

Checks
  • Σ must be symmetric positive definite for the inverse and positive density to be stably defined.
  • Obtain probabilities through interval integration, distinct from pointwise density.

Symbols

Symbols used in this equation
SymbolMeaning
CCTotal class count or a matrix; check context

Reference-quality follow-up

Explore this calculation further
PDF p. 11 · 2.7.2 Gaussian pattern classes Identifier: MAI-P2-099

This equals the minimum-distance discriminant in equation (2). Minimum-distance classification is therefore Bayes-optimal for Gaussian classes with identity covariances and equal priors.

These classes form equally shaped spherical clouds in N dimensions, separated by perpendicular-bisector hyperplanes between their centers.

(a) 1D

● ● ● ● ●

5 points

(b) 2D

●●●●●
●●●●●
●●●●●
●●●●●
●●●●●

25 points

(c) 3D

5×5×5 grid

125 points

Figure 5, reconstructed. Keeping five samples per axis requires 5 points in 1D, 25 in 2D, and 125 in 3D.

#2.7.3 Naive Bayes classifier

Assume individual features xn,n=1,…,Nx_n,\qquad n=1,\ldots,N are conditionally independent given class S_c.

The source writes the resulting posterior relationship as follows.

Source notation requires review · PDF p. 12

Naive Bayes multiplies feature likelihoods under conditional independence
p(Sc∣x)∝∏n=1Np(xn∣Sc)p(S_c\mid x)\propto\prod_{n=1}^{N}p(x_n\mid S_c)
Explanation and calculations 5 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

Which class scores highest after observing several features?

Key idea

Multiply class priors by successive conditional feature likelihoods and compare classes.

Formula-specific lesson

When does omitting the prior change naive Bayes?

Calculate conditional feature-likelihood products, then compare MAP scores with and without priors.

Structure explanation
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Prepare class priors

    P(Sc)P(S_c)
  2. 2

    Calculate conditional feature likelihoods

    p(xn∣Sc)p(x_n\mid S_c)
  3. 3

    Multiply all terms

    scorec=P(Sc)∏np(xn∣Sc)\text{score}_c=P(S_c)\prod_np(x_n\mid S_c)
  4. 4

    Use sums of logarithms for numerical stability

    log⁡scorec=log⁡P(Sc)+∑nlog⁡p(xn∣Sc)\log\text{score}_c=\log P(S_c)+\sum_n\log p(x_n\mid S_c)
  5. 5

    Select the highest-scoring class

    c∗=arg⁡max⁡cscorecc^*=\arg\max_c\text{score}_c

Worked example

Work through the numbers — Two features and two classes

S₁: prior=.6, likelihoods=.8,.5; S₂: prior=.4, likelihoods=.3,.9.

  1. 1

    S₁ score

    0.6⋅0.8⋅0.5=0.240.6\cdot0.8\cdot0.5=0.24
  2. 2

    S₂ score

    0.4⋅0.3⋅0.9=0.1080.4\cdot0.3\cdot0.9=0.108

Result: Since 0.24>0.108, select S₁.

Sanity check

Checks
  • A general MAP expression includes class prior P(S_c).
  • Many multiplied features can underflow, so use log-domain calculations.

Symbols

Symbols used in this equation
SymbolMeaning
∏\prodMultiply all specified terms
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 12 · 2.7.3 Naive Bayes classifier Identifier: MAI-P2-102
  • Estimate separate univariate conditional densities instead of facing direct multivariate p(x|S_c) estimation.
  • Accuracy can remain surprisingly high even when actual feature independence fails.

#2.8 Reinforcement learning

Some algorithms do not encounter only fixed datasets. Reinforcement learning interacts with the environment, creating feedback between experience and policy. The lecture places it outside this course’s scope and refers readers to Sutton–Barto and the DQN paper.

#2.9 The curse of dimensionality

Many learning problems become extremely difficult as data dimension grows: the curse of dimensionality.

The source describes high-dimensional data as having more features than observations, emphasizing the deeper issue of too little data relative to intrinsic dimension.

Source equation · PDF p. 12

Identify the equation's role and symbols
Nfeatures>NobservationsN_{\mathrm{features}}>N_{\mathrm{observations}}
Explanation Core explanation · Formula-specific lesson

The question this equation answers

What does this equation define or connect in the article?

Key idea

For equations without an actual calculation or derivation, briefly clarify context and symbols rather than attaching a generic procedure.

Formula-specific lesson

The cost of maintaining resolution as dimension grows

Connect r^N grid growth for r points per axis with MAI-P2-100's feature/observation imbalance.

Interactive
Loading the lesson matched to this equation and derivation step.

Reference-quality follow-up

Explore this calculation further
PDF p. 12 · 2.9 Curse of dimensionality Identifier: MAI-P2-100

More feature dimensions increase both computation and the training data needed for useful models.

#2.9.1 Dimensionality reduction as a major response

Dimensionality reduction reduces the variables considered, retaining important information while removing redundant or less relevant features.

  • Principal component analysis (PCA)
  • Linear discriminant analysis (LDA)
  • t-distributed stochastic neighbor embedding (t-SNE)

#2.9.2 Does deep learning overcome dimensionality?

The lecture cites practical image-classification experience with deep networks handling inputs as large as 7,500 dimensions. CNNs and Transformers often outperform traditional methods on high-dimensional inputs.

It explicitly describes why deep learning often suffers less from dimensionality as an open question.

  • Hypothesis 1: the manifold hypothesis and automatic feature extraction. High-dimensional observations may contain low-dimensional effective structure.
  • Hypothesis 2: locality and symmetry. Structural inductive biases reduce the function space to search.
  • Hypothesis 3: regularization. Weight decay, dropout, augmentation, and early stopping aid generalization.

The lecture concludes that deep learning mitigates dimensionality in many problems without becoming immune to all high-dimensional limitations.

Data quality, architecture, tuning, and compute still affect performance; some problems need feature engineering or additional tuning.

#References in the original source

  1. I. Goodfellow, Y. Bengio, A. Courville, Deep Learning, MIT Press, 2016 — http://www.deeplearningbook.org.
  1. R. S. Sutton, A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018.
  1. V. Mnih et al., “Human-level control through deep reinforcement learning,” Nature, no. 7540, pp. 529–533, Feb. 2015.

#Editorial and mathematical audit

#1. Completing ?? in equation (6)

Completed source placeholder · PDF p. 9 · Eq. (6) completed

Bayes' rule normalizes likelihood times prior by total evidence
P(Sc∣x)=p(x∣Sc)P(Sc)p(x)P(S_c\mid x)=\frac{p(x\mid S_c)P(S_c)}{p(x)}
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · Eq. (6) completed · Editorial completion for 2.7.1 Identifier: MAI-P2-067

Divide two factorizations of joint probability by p(x). The original blank is preserved, and this expression is separately registered as editorially-completed.

#2. Completing ?? in 0–1 risk

Completed source placeholder · PDF p. 9

Bayes' rule normalizes likelihood times prior by total evidence
Rc′(x)=p(x)−p(x∣Sc′)P(Sc′)R_{c\prime}(x)=p(x)-p(x\mid S_{c\prime})P(S_{c\prime})
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Posterior normalization and Bayes risk

Normalize likelihood times prior by evidence, then use the same posterior to calculate actionwise conditional risks under 0–1 and asymmetric losses.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 9 · Editorial completion for 2.7.1 Identifier: MAI-P2-076

The full sum equals p(x); only the c=c′ term is omitted under 0–1 loss, giving this expression.

#3. A missing square in the univariate Gaussian exponent

Mathematically corrected variant · PDF p. 10

Bayes' rule normalizes likelihood times prior by total evidence
dc(x)=p(x∣Sc)P(Sc)=12πσcexp⁡ ⁣[−(x−mc)22σc2]P(Sc),c=1,2d_c(x)=p(x\mid S_c)P(S_c)=\frac{1}{\sqrt{2\pi}\sigma_c}\exp\!\left[-\frac{(x-m_c)^2}{2\sigma_c^2}\right]P(S_c),\qquad c=1,2
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

Gaussian QDA → LDA → minimum-distance

Compare class-specific-covariance QDA, shared-covariance LDA, and identity-covariance/equal-prior minimum distance at one 2D point, keeping the suspect univariate Gaussian separate from its correction.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
σ\sigmaStandard deviation or sigmoid notation
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 10 · Editorial correction for 2.7.2 Identifier: MAI-P2-088

The printed exponent numerator (x-m_c)^2 on PDF p. 10 has no visible square. A corrected variant accompanies it based on multivariate equation (9) and the standard univariate normal density.

#4. Priors in the naive Bayes equation

Mathematically corrected variant · PDF p. 12

Bayes' rule normalizes likelihood times prior by total evidence
p(Sc∣x)∝P(Sc)∏n=1Np(xn∣Sc)p(S_c\mid x)\propto P(S_c)\prod_{n=1}^{N}p(x_n\mid S_c)
Explanation and calculations 4 calculation steps · Numerical example · Checks included · Formula-specific lesson

The question this equation answers

What is class S's probability after observing x?

Key idea

Multiply the observation's class likelihood by the prior class proportion, then divide by p(x), summing all explanations.

Formula-specific lesson

When does omitting the prior change naive Bayes?

Calculate conditional feature-likelihood products, then compare MAP scores with and without priors.

Interactive
Loading the lesson matched to this equation and derivation step.

Calculation walkthrough

Calculation steps
Intermediate calculations included
  1. 1

    Identify the prior

    P(S)P(S)
  2. 2

    Calculate class likelihoods

    p(x∣S)p(x\mid S)
  3. 3

    Multiply them to form joint scores

    p(x∣S)P(S)p(x\mid S)P(S)
  4. 4

    Divide by the sum of all class scores

    P(S∣x)=p(x∣S)P(S)p(x)P(S\mid x)=\frac{p(x\mid S)P(S)}{p(x)}

Worked example

Work through the numbers — Calculating a posterior

Suppose P(S)=0.4, p(x|S)=0.3, and p(x)=0.2.

  1. 1

    Numerator

    0.3⋅0.4=0.120.3\cdot0.4=0.12
  2. 2

    Normalization

    0.12/0.2=0.60.12/0.2=0.6

Result: After observation, class S has probability 0.6.

Note: Calculate p(x) by summing p(x|S_c)P(S_c) across classes.

Sanity check

Checks
  • Posterior probabilities must sum to one across classes.
  • For classification alone, omitting the common denominator p(x) preserves rankings.

Symbols

Symbols used in this equation
SymbolMeaning
∏\prodMultiply all specified terms
P(⋅)P(\cdot)Event probability
p(⋅)p(\cdot)Probability density or conditional probability density

Reference-quality follow-up

Explore this calculation further
PDF p. 12 · Editorial correction for 2.7.3 Identifier: MAI-P2-103

The source expression applies unchanged only for equal priors or where P(S_c) is absorbed into a proportionality factor. General MAP classification retains the prior.

#5. Conditions for closed-form linear regression

Equation (1) assumes invertible XᵀX. Linear dependence or overparameterization with N>L requires a Moore–Penrose pseudoinverse, minimum-norm solution, or ridge regularization. The source equation itself is unchanged.

#6. Conditional-risk index conventions

The PDF describes R_{c′}(x) as the risk of assigning x to S_{c′} while writing loss L(a_c|S_{c′}) in the sum. Many textbooks reverse action and true-class indices, writing L(a_{c′}|S_c). We preserve the source notation and explicitly state its meaning.

#7. The covariance denominator

The PDF’s 1/M_c corresponds to Gaussian maximum likelihood or a second-moment-style estimator. Common unbiased covariance instead multiplies the centered sum by 1/(M_c−1). Different purposes do not make the source a typographical error.

#8. Scope of regularization

The lecture defines regularization as modifications intended to reduce generalization rather than training error. Modern usage includes augmentation, early stopping, and implicit optimization biases. Actual generalization improvement still depends on data, model, and training procedure.

Several captions say “this link” or “wiki,” but the PDF retains no active link annotations, so their URIs could not be reliably recovered. Visible source labels remain in the ledger; destinations are not guessed.


#Research update: August 18, 2026

The following is not PDF source material. It tracks extensions of the lecture’s questions through peer-reviewed 2025–2026 papers and official proceedings.

#1. Generalization extends beyond new samples from the same distribution

The i.i.d. framework remains a theoretical reference, but deployment changes sensors, regions, user groups, time, class ratios, and background correlations. Distinguish in-distribution performance, distribution shift, OOD generalization, and OOD detection.

  • ICML 2025, peer-reviewed: Qiang et al. analyze how self-supervised learning can acquire spurious correlations and lose OOD generalization, proposing batch construction targeting a causal post-intervention distribution. PMLR paper
  • ICML 2025, peer-reviewed: Harun et al. report a layerwise trade-off in which stronger neural collapse can help OOD detection yet hurt OOD generalization. Rejecting unfamiliar inputs and predicting well on them are different objectives. PMLR paper
  • UAI 2025, peer-reviewed: Cai et al. distinguish ordinary out-of-sample robustness from OOD robustness with different training and test environments, showing that structural assumptions such as covariate or label shift may be necessary for nontrivial solutions. PMLR paper

Modern test sets should therefore include environment, temporal, group, and difficulty splits specifying anticipated changes, rather than one random holdout alone.

#2. Overparameterized models challenge “zero training error means overfitting”

Classical capacity diagrams suggest worsening test error after fitting training data exactly. Modern research studies double descent, where risk falls again beyond interpolation; benign overfitting, which fits noise yet generalizes; and implicit regularization, through which optimization selects particular solutions.

  • ICML 2025, peer-reviewed: Xu and Chen analyze two-layer networks with class-dependent heterogeneous noise, showing how some long-tail noise can aid implicit feature learning. Benign versus harmful overfitting depends on data structure and learning dynamics, not parameter count alone. PMLR paper
  • ICML 2025, peer-reviewed: Sakamoto and Sato analyze signal-to-noise conditions under which attention token selection generalizes despite fitting label noise. PMLR paper
  • COLT 2026, peer-reviewed extended abstract: Wu et al. compare finite-sample risks of early-stopped GD, ridge, and online SGD instance by instance in linear regression. GD can dominate ridge within constants in some regimes, yet SGD can be polynomially better than optimally stopped GD in benign-overfitting-type problems. No regularizer is always superior. PMLR paper

The capacity diagram remains introductory, but examine function spaces, data spectra, margins, optimization paths, and stopping times too.

#3. Repeatedly reused validation data become training information

Define train/validation/test by information flow, not labels. Repeatedly consulting the same evaluation results during development fits the research process to that set, even without direct model gradients.

  • NeurIPS 2025 Datasets & Benchmarks, peer-reviewed: TabArena proposes a living benchmark addressing static-benchmark defects and aging versions. Time budgets, ensembles, and validation choices substantially affect rankings; overrepresentation of some models in cross-model ensembles is linked to validation overfitting. Official proceedings
  • NeurIPS 2025 Datasets & Benchmarks, peer-reviewed: The Scientific ML Common Task Framework proposes standardized tasks, realistic noise, limited data, and genuinely hidden tests to reduce weak baselines, reporting bias, and inconsistent evaluation. Official proceedings
  • COLT 2026, peer-reviewed: Nachum et al. analyze k-fold CV as a data-reusing risk estimator and give unavoidable minimax MSE lower bounds when fold count grows with sample size. Cross-validation is not an infinitely precise evaluator. PMLR paper

Practical protocols should include group/patient/entity splits, temporal splits, fitting preprocessing and feature selection within folds, nested CV, one final test use, and disclosed seeds/folds.

#4. Accuracy alone does not describe risk: calibration and conformal prediction

Calibration asks whether predictions assigned probability 0.9 are correct about 90% of the time. Good aggregate calibration can still fail for subgroups, OOD inputs, or temporal changes. Conformal prediction provides finite-sample coverage under exchangeability or i.i.d. assumptions, which must be revisited under shift.

  • ICML 2025, peer-reviewed: Van der Laan and Alaa extend Venn/Venn–Abers methods to general losses, proposing finite-sample set-valued calibration and subpopulation multicalibration. PMLR paper
  • ICML 2025, peer-reviewed: Bashari, Sesia, and Romano analyze partly contaminated reference sets for conformal outlier detection. Under nonadversarial conditions, type-I error remains conservatively controlled while power declines. PMLR paper
  • ALT 2026, peer-reviewed: Vovk quantifies efficiency universality of conformal predictors under i.i.d. randomness. This supports their strength, not unconditional validity under shift. PMLR paper

Alongside accuracy/F1, record reliability diagrams, ECE bin dependence, NLL/Brier scores, prediction-set coverage and size, subgroup coverage, and shift-specific performance.

#5. From observed dimension to effective dimension and inductive bias

Handling high-dimensional inputs does not eliminate dimensionality limits. Ask which low-dimensional structures models actually exploit and whether those structures persist in testing.

  • ICML 2025, peer-reviewed: Dong et al. analyze weak-to-strong fine-tuning through ridgeless regression, explaining variance reduction through adaptation in a low-intrinsic-dimensional subspace. PMLR paper
  • ICML 2025, peer-reviewed: Chen et al. show that low-to-high-dimensional generalization requires suitable inductive bias; architecture and (S)GD must select interpolators aligned with the target. PMLR paper
  • COLT 2026, peer-reviewed open problem: Feldman, Kamath, and Srebro formally ask whether deep learning’s advantage over linear models is inherently distribution-dependent. Why deep learning mitigates dimensionality remains open in 2026. PMLR paper

Replace “many pixels, yet DNNs work” with measurements of intrinsic/effective dimension, architectural symmetry, locality, data spectra, and sample-to-dimension ratios.

#6. Classical classifiers remain strong baselines

SVMs, minimum-distance classifiers, LDA/QDA, and naive Bayes are not universal competitors to large foundation models, but remain important for small datasets, interpretability, probabilistic-assumption checks, calibration, and inexpensive deployment.

  • Nearest class mean is Gaussian Bayes with shared identity covariance and equal priors.
  • LDA gives Gaussian Bayes boundaries with shared covariance; QDA allows class-specific covariances.
  • SVM kernels support convex optimization in fixed feature spaces, but kernel-matrix time and memory become bottlenecks at large sample counts.
  • Even when independence fails, naive Bayes offers useful low-variance, fast-learning bias with limited data.

#Key terms

TermMeaning
GeneralizationMaintaining low risk on unseen inputs; specify shift/OOD axes as well as i.i.d. evaluation.
Capacity and interpolationGeneralization depends on data spectra, margins, optimization paths, and implicit regularization, not just parameter count.
Validation leakageRepeated use of validation/test results in development effectively fits those evaluation sets.
CalibrationAgreement between predicted probabilities and observed frequencies, checked by group, OOD condition, and time.
Conformal predictionSet-valued predictions with finite-sample coverage under exchangeability; reassess assumptions and weighting under shift.
Intrinsic dimensionEffective degrees of freedom actually used rather than observed dimension; a candidate explanation for high-dimensional generalization.

#Research questions and next experiments

  1. Split units in robot vision: how do frame-random, sequence, and subject/site splits change performance and calibration?
  2. Explaining post-interpolation generalization: when comparing ridge, early-stopped GD, and SGD with matched linear, kernel, and neural features, how do covariance spectra relate to risk curves?
  3. Shift-aware uncertainty: which layers, representations, and regularizers form a Pareto frontier when seeking ID calibration, OOD detection, and conformal coverage together?

#Recent research references

  • Qiang et al., On the Out-of-Distribution Generalization of Self-Supervised Learning, ICML 2025.
  • Harun et al., Controlling Neural Collapse Enhances Out-of-Distribution Detection and Transfer Learning, ICML 2025.
  • Xu & Chen, Rethinking Benign Overfitting in Two-Layer Neural Networks, ICML 2025.
  • Wu et al., Risk Comparisons in Linear Regression: Implicit Regularization Dominates Explicit Regularization, COLT 2026.
  • Nachum et al., Minimax Limits of k-Fold Cross-Validation via Majority, COLT 2026.
  • Van der Laan & Alaa, Generalized Venn and Venn-Abers Calibration with Applications in Conformal Prediction, ICML 2025.
  • Vovk, Universality of Conformal Prediction under the Assumption of Randomness, ALT 2026.
  • Dong et al., Discrepancies are Virtue: Weak-to-Strong Generalization through Lens of Intrinsic Dimension, ICML 2025.
  • Feldman, Kamath, Srebro, Is the Power of Deep Learning over Linear Models Inherently Distribution Dependent?, COLT 2026.

Connect