Mathematical Foundations

IV.14 · Probability

What does a probability-weighted tilt reveal about dependence?

Center a joint distribution, add its weighted cross-products, and compare association across scales. Then inspect a nonlinear relation that correlation misses.

Weight the scatter before measuring association

Weighted X,Y scatter · circle area is joint probability
Weighted X,Y scatter · circle area is joint probabilityU=-1, V=-1: exact joint mass 0.125; U=-1, V=0: exact joint mass 0.125; U=-1, V=1: exact joint mass 0; U=0, V=-1: exact joint mass 0.125; U=0, V=0: exact joint mass 0.25; U=0, V=1: exact joint mass 0.125; U=1, V=-1: exact joint mass 0; U=1, V=0: exact joint mass 0.125; U=1, V=1: exact joint mass 0.125. X=1U+0, Y=1V+0. Coinciding mapped points combine their masses. Covariance 0.25; correlation approximately 0.5. X and Y are dependent. Correlation describes linear association, not causation.2-2-101

Horizontal coordinate X · vertical coordinate Y · dashed lines mark marginal expectations

Underlying U,V joint weights · affine images are shown in the scatter
U ↓ / V →Row mass
0.25
0.5
0.25
Column mass0.250.50.251

U=-1, V=-1: exact joint mass 0.125; U=-1, V=0: exact joint mass 0.125; U=-1, V=1: exact joint mass 0; U=0, V=-1: exact joint mass 0.125; U=0, V=0: exact joint mass 0.25; U=0, V=1: exact joint mass 0.125; U=1, V=-1: exact joint mass 0; U=1, V=0: exact joint mass 0.125; U=1, V=1: exact joint mass 0.125. X=1U+0, Y=1V+0. Coinciding mapped points combine their masses. Covariance 0.25; correlation approximately 0.5. X and Y are dependent. Correlation describes linear association, not causation.

X expectation
0
Y expectation
0
X variance
0.5
Y variance
0.5
Covariance
0.25
Correlation
0.5

= exact model quantity · ≈ numerical companion or observed estimate

from 0 to 100, whole numbers only

from −3 to 3, up to 2 decimal places

from −3 to 3, up to 2 decimal places

from −3 to 3, up to 2 decimal places

from −3 to 3, up to 2 decimal places

Covariance 0.25; correlation approximately 0.5. X and Y are dependent. Correlation describes linear association, not causation.
Cov⁡(X,Y)=E[XY]−E[X]E[Y]=0.25−0⋅0=0.25\operatorname{Cov}(X,Y)=E[XY]-E[X]E[Y]=0.25-0\cdot0=0.25
Cov⁡(aU+b,cV+d)=acCov⁡(U,V)\operatorname{Cov}(aU+b,cV+d)=ac\operatorname{Cov}(U,V)
ρX,Y=Cov⁡(X,Y)σXσY(σXσY>0)\rho_{X,Y}=\frac{\operatorname{Cov}(X,Y)}{\sigma_X\sigma_Y}\quad(\sigma_X\sigma_Y>0)

Normalize the nine joint weights

The table is an indexed U,V outcome model. Nonnegative raw weights divide by their positive total.

∑i,jpij=1\sum_{i,j}p_{ij}=1

Read the weighted scatter and centered products from one joint table. Transform X=aU+b and Y=cV+d, then compare covariance, variances, and correlation.

Predict how reflection of one coordinate changes the sign of association. Predict what remains defined when one scale becomes zero.

Intuition: signs of centered products

When both coordinates lie above their means, their deviations have the same sign and their product is positive. The same is true when both lie below their means. Opposite deviations contribute negative products. Covariance adds those products using probability weights.

The picture must preserve mass: a point of probability 1/41/4 contributes twice the weight of a point of probability 1/81/8. A scatterplot’s occupied locations alone are insufficient. Positive covariance suggests a shared linear direction; cancellation can hide a curved relationship.

Definition

For finite second moments, write μX=E[X]\mu_X=\mathbb E[X] and μY=E[Y]\mu_Y=\mathbb E[Y]. Covariance is

Cov⁡(X,Y)=E[(X−μX)(Y−μY)]=∑i,jpij(xi−μX)(yj−μY).\operatorname{Cov}(X,Y)=\mathbb E[(X-\mu_X)(Y-\mu_Y)] =\sum_{i,j}p_{ij}(x_i-\mu_X)(y_j-\mu_Y).

If both variances are positive, correlation is

ρ(X,Y)=Cov⁡(X,Y)σXσY,−1≤ρ≤1.\rho(X,Y)=\frac{\operatorname{Cov}(X,Y)}{\sigma_X\sigma_Y}, \qquad -1\leq\rho\leq1.

Covariance has the product of the two variables’ units. Correlation is dimensionless. If either variable is constant on positive-mass outcomes, its variance is zero and correlation is undefined, even though covariance is well defined and zero.

Mechanics: distinguish latent cells from mapped points

The latent table uses U,V∈{−1,0,1}U,V\in\{-1,0,1\} and canonical weights [1,1,0;1,2,1;0,1,1][1,1,0;1,2,1;0,1,1]. The mapped variables are X=aU+bX=aU+b and Y=cV+dY=cV+d. The stage keeps the table clearly labeled by latent U,VU,V, while its scatterplot and association rows describe mapped X,YX,Y.

Change a scale or shift through the controls. If multiple latent cells map to one scatter location, their probability masses are merged. A zero scale is valid and collapses one mapped variable to a constant; it does not erase or rewrite the latent table. Reset restores identity maps and canonical weights.

Derivation: centering removes shifts

Expanding the centered product gives

Cov⁡(X,Y)=E[XY]−E[X]E[Y].\operatorname{Cov}(X,Y)=\mathbb E[XY]-\mathbb E[X]\mathbb E[Y].

For affine transformations, aU+b−E[aU+b]=a(U−E[U])aU+b-\mathbb E[aU+b]=a(U-\mathbb E[U]), hence

Cov⁡(aU+b,cV+d)=acCov⁡(U,V).\operatorname{Cov}(aU+b,cV+d)=ac\operatorname{Cov}(U,V).

The two variances multiply by a2a^2 and c2c^2. When both scales are nonzero,

ρ(aU+b,cV+d)=ac∣a∣∣c∣ρ(U,V).\rho(aU+b,cV+d)=\frac{ac}{|a||c|}\rho(U,V).

Shifts leave covariance and correlation unchanged. Positive changes of units preserve correlation. Reflecting exactly one axis flips its sign; reflecting both restores it. The correlation formula above does not extend to a zero scale.

Worked examples

Canonical means are zero and both variances are 1/21/2. Only the two mass-1/81/8 diagonal corners contribute nonzero UVUV, so

Cov⁡(U,V)=18+18=14,ρ(U,V)=1/4(1/2)(1/2)=12.\operatorname{Cov}(U,V)=\frac18+\frac18=\frac14, \qquad \rho(U,V)=\frac{1/4}{\sqrt{(1/2)(1/2)}}=\frac12.

For X=−2U+3X=-2U+3 and Y=3V−1Y=3V-1, means become 3,−13,-1, variances become 2,9/22,9/2, and covariance becomes −3/2-3/2. Its correlation is −1/2-1/2.

Worked example: Weight the scatter before measuring association

Weighted X,Y scatter · circle area is joint probability
Weighted X,Y scatter · circle area is joint probabilityU=-1, V=-1: exact joint mass 0.125; U=-1, V=0: exact joint mass 0.125; U=-1, V=1: exact joint mass 0; U=0, V=-1: exact joint mass 0.125; U=0, V=0: exact joint mass 0.25; U=0, V=1: exact joint mass 0.125; U=1, V=-1: exact joint mass 0; U=1, V=0: exact joint mass 0.125; U=1, V=1: exact joint mass 0.125. X=1U+0, Y=1V+0. Coinciding mapped points combine their masses. Covariance 0.25; correlation approximately 0.5. X and Y are dependent. Correlation describes linear association, not causation.2-2-101

Horizontal coordinate X · vertical coordinate Y · dashed lines mark marginal expectations

Underlying U,V joint weights · affine images are shown in the scatter
U ↓ / V →Row mass
0.25
0.5
0.25
Column mass0.250.50.251

U=-1, V=-1: exact joint mass 0.125; U=-1, V=0: exact joint mass 0.125; U=-1, V=1: exact joint mass 0; U=0, V=-1: exact joint mass 0.125; U=0, V=0: exact joint mass 0.25; U=0, V=1: exact joint mass 0.125; U=1, V=-1: exact joint mass 0; U=1, V=0: exact joint mass 0.125; U=1, V=1: exact joint mass 0.125. X=1U+0, Y=1V+0. Coinciding mapped points combine their masses. Covariance 0.25; correlation approximately 0.5. X and Y are dependent. Correlation describes linear association, not causation.

X expectation
0
Y expectation
0
X variance
0.5
Y variance
0.5
Covariance
0.25
Correlation
0.5

= exact model quantity · ≈ numerical companion or observed estimate

from 0 to 100, whole numbers only

from −3 to 3, up to 2 decimal places

from −3 to 3, up to 2 decimal places

from −3 to 3, up to 2 decimal places

from −3 to 3, up to 2 decimal places

Covariance 0.25; correlation approximately 0.5. X and Y are dependent. Correlation describes linear association, not causation.
Cov⁡(X,Y)=E[XY]−E[X]E[Y]=0.25−0⋅0=0.25\operatorname{Cov}(X,Y)=E[XY]-E[X]E[Y]=0.25-0\cdot0=0.25
Cov⁡(aU+b,cV+d)=acCov⁡(U,V)\operatorname{Cov}(aU+b,cV+d)=ac\operatorname{Cov}(U,V)
ρX,Y=Cov⁡(X,Y)σXσY(σXσY>0)\rho_{X,Y}=\frac{\operatorname{Cov}(X,Y)}{\sigma_X\sigma_Y}\quad(\sigma_X\sigma_Y>0)

Normalize the nine joint weights

The table is an indexed U,V outcome model. Nonnegative raw weights divide by their positive total.

∑i,jpij=1\sum_{i,j}p_{ij}=1

Recover canonical covariance 1/4 and correlation 1/2. Reflect one coordinate, shift both, and collapse a scale to zero to inspect the undefined-correlation policy.

A different table, [0,0,1;0,1,0;0,0,1][0,0,1;0,1,0;0,0,1], assigns equal mass to (−1,1),(0,0),(1,1)(-1,1),(0,0),(1,1). Here V=U2V=U^2. Its moments are

E[U]=0,E[V]=23,Var⁡(U)=23,Var⁡(V)=29.\mathbb E[U]=0,\quad\mathbb E[V]=\frac23,\quad \operatorname{Var}(U)=\frac23,\quad\operatorname{Var}(V)=\frac29.

Symmetry gives E[UV]=0\mathbb E[UV]=0, so covariance and correlation are zero. Yet P(V=0∣U=0)=1\mathbb P(V=0\mid U=0)=1 differs from P(V=0)=1/3\mathbb P(V=0)=1/3. The dependence is nonlinear and exact.

Executable reference code

The exact reference computes centered weighted products with Fraction, checks the alternative moment identity, and merges mapped points. It tests mapped independence separately from latent dependence, including the constant-variable collapse. Correlation is approximate when its square-root denominator is irrational.

The NumPy reference explicitly weights the nine cell coordinates. Calling an unweighted sample covariance routine on nine cell labels would ignore their probabilities and include zero-mass locations as observations; that is a different calculation.

code/python/probability_covariance.py
"""Centered exact covariance for mapped latent U,V; correlation may be undefined."""
from fractions import Fraction as F
from math import sqrt


def association(weights, a=F(1), b=F(0), c=F(1), d=F(0)):
    if len(weights) != 9 or any(type(w) is not int or not 0 <= w <= 1_000_000 for w in weights) or sum(weights) <= 0:
        raise ValueError("Require nine bounded nonnegative integer weights of positive total")
    if any(isinstance(s, bool) or not isinstance(s, (int,F)) or abs(s)>1_000_000 for s in (a,b,c,d)):
        raise ValueError("Use exact integer or Fraction affine parameters bounded by 1000000")
    values = [-1,0,1]
    points = [(a*u+b,c*v+d,F(weights[3*i+j],sum(weights))) for i,u in enumerate(values) for j,v in enumerate(values)]
    ex = sum((x*p for x,y,p in points), F(0))
    ey = sum((y*p for x,y,p in points), F(0))
    vx = sum((p*(x-ex)**2 for x,y,p in points), F(0))
    vy = sum((p*(y-ey)**2 for x,y,p in points), F(0))
    cov = sum((p*(x-ex)*(y-ey) for x,y,p in points), F(0))
    assert cov == sum((p*x*y for x,y,p in points),F(0))-ex*ey
    rho = None if vx == 0 or vy == 0 else float(cov)/sqrt(float(vx*vy))
    merged = {}
    for x,y,p in points:
        if p:
            merged[x,y] = merged.get((x,y),F(0))+p
    mx = {x: sum((p for (u,v),p in merged.items() if u==x), F(0)) for x,y in merged}
    my = {y: sum((p for (u,v),p in merged.items() if v==y), F(0)) for x,y in merged}
    independent = all(merged.get((x,y),F(0)) == px*py for x,px in mx.items() for y,py in my.items())
    return ex, ey, vx, vy, cov, rho, independent, merged


def main():
    w=[1,1,0,1,2,1,0,1,1]
    assert association(w)[:6] == (F(0),F(0),F(1,2),F(1,2),F(1,4),.5)
    assert association(w,-2,3,3,-1)[:6] == (F(3),F(-1),F(2),F(9,2),F(-3,2),-.5)
    collapsed=association(w,0,3)
    assert collapsed[2] == 0 and collapsed[5] is None and collapsed[6]
    assert len(collapsed[7]) == 3 and sum(collapsed[7].values()) == 1
    nonlinear=association([0,0,1,0,1,0,0,0,1])
    assert nonlinear[:6] == (F(0),F(2,3),F(2,3),F(2,9),F(0),0.) and not nonlinear[6]
    assert association([1,2,1,2,4,2,1,2,1])[6]
    for a in (-2,0,1,3):
        for c in (-3,0,1,2):
            result=association(w,a,7,c,-4)
            assert result[2:5] == (F(a*a,2),F(c*c,2),F(a*c,4))
            assert result[5] is None if a*c==0 else abs(result[5]) == .5
    print("Canonical moments, covariance, correlation:",association(w)[:6])
    print("Nonlinear zero correlation is still dependent:",nonlinear[:7])
    print("Constant correlation is undefined. Association alone is not causation.")


if __name__ == "__main__":
    main()
code/python/probability_covariance_numpy.py
"""Weighted theoretical covariance, not NumPy's unweighted sample covariance."""
import numpy as np


def association(weights, a=1., b=0., c=1., d=0.):
    w=np.asarray(weights,dtype=float)
    if w.shape != (3,3) or not np.all(np.isfinite(w)) or np.any(w<0) or not np.isfinite(w.sum()) or w.sum()<=0:
        raise ValueError("Require a finite nonnegative 3x3 table of positive total")
    if not np.all(np.isfinite([a,b,c,d])) or np.any(np.abs([a,b,c,d])>1_000_000):
        raise ValueError("Affine parameters must be finite and bounded by 1000000")
    p=w/w.sum()
    u,v=np.meshgrid([-1.,0.,1.],[-1.,0.,1.],indexing='ij')
    x,y=a*u+b,c*v+d
    ex,ey=np.sum(p*x),np.sum(p*y)
    # Constancy is a support property; floating centering can leave a spurious tiny variance.
    active=p>0
    constant_x=np.all(x[active]==x[active][0])
    constant_y=np.all(y[active]==y[active][0])
    if constant_x:
        ex=x[active][0]
    if constant_y:
        ey=y[active][0]
    dx,dy=x-ex,y-ey
    vx,vy,cov=np.sum(p*dx*dx),np.sum(p*dy*dy),np.sum(p*dx*dy)
    if constant_x or constant_y:
        cov=0.
    if (not constant_x and vx==0) or (not constant_y and vy==0):
        raise ValueError("A nonconstant marginal variance underflowed; rescale the numerical inputs")
    rho=None if constant_x or constant_y else float(cov/np.sqrt(vx)/np.sqrt(vy))
    return float(ex),float(ey),float(vx),float(vy),float(cov),rho


def main():
    w=[[1,1,0],[1,2,1],[0,1,1]]
    np.testing.assert_allclose(association(w),[0,0,.5,.5,.25,.5],rtol=0,atol=1e-14)
    np.testing.assert_allclose(association(w,-2,3,3,-1),[3,-1,2,4.5,-1.5,-.5],rtol=0,atol=1e-14)
    collapsed=association(w,0,3)
    assert collapsed[2]==0 and collapsed[5] is None
    for shift in (.1,.3,-.7):
        result=association(w,0,shift)
        assert result[0]==shift and result[2]==0 and result[4]==0 and result[5] is None
    one_row=association([[0,0,0],[1,1,1],[0,0,0]],1,.3)
    assert one_row[2]==0 and one_row[5] is None
    try:
        association(w,1e-300)
    except ValueError:
        pass
    else:
        raise AssertionError("Nonconstant variance underflow was silently accepted")
    nonlinear=association([[0,0,1],[0,1,0],[0,0,1]])
    np.testing.assert_allclose(nonlinear,[0,2/3,2/3,2/9,0,0],rtol=0,atol=1e-14)
    for a in (-2,0,1,3):
        for c in (-3,0,1,2):
            result=association(w,a,7,c,-4)
            np.testing.assert_allclose(result[2:5],[a*a/2,c*c/2,a*c/4],rtol=0,atol=1e-14)
            if a*c==0:
                assert result[5] is None
            else:
                np.testing.assert_allclose(result[5],np.sign(a*c)*.5,rtol=0,atol=1e-14)
    for bad in (np.zeros((3,3)),[[-1,0,0],[0,0,0],[0,0,1]],np.full((3,3),np.inf)):
        try:
            association(bad)
        except ValueError:
            pass
        else:
            raise AssertionError("Invalid table accepted")
    print("Weighted theoretical association ≈",association(w))
    print("Do not use np.cov on nine cell labels as nine equally likely samples.")
    print("Zero correlation can conceal nonlinear dependence; it proves no causal direction.")


if __name__ == "__main__":
    main()

Explore

Shift both coordinates and verify that centered association remains fixed while the means move. Scale one axis by −2-2 and predict its variance, covariance, and correlation before inspecting the answer. Scale both axes negatively and explain why correlation’s sign returns.

Use the reversed preset for a sign change, the collapsed preset for a constant variable, or the diagonal preset for perfect positive association. Inspect the nonlinear example and identify which conditional probability disproves independence. Finally set a=0a=0. Explain how constant X=bX=b is independent of YY even if the latent U,VU,V remain dependent, and why this does not make correlation defined.

Common mistakes and counterexamples

Independence with finite second moments implies zero covariance: independence factors E[XY]\mathbb E[XY]. The converse fails in the V=U2V=U^2 example. Zero correlation means no centered linear association; it does not mean no relationship.

Variance of a sum includes association:

Var⁡(X+Y)=Var⁡(X)+Var⁡(Y)+2Cov⁡(X,Y).\operatorname{Var}(X+Y)=\operatorname{Var}(X)+\operatorname{Var}(Y) +2\operatorname{Cov}(X,Y).

For canonical U,VU,V, the result is 3/23/2, not 11. Correlation also cannot establish causation: a common cause, selection rule, or measurement process can produce association without a direct causal effect.

Numerical considerations

The stage preserves exact fractions for bounded weights, moments, covariance, and affine parameters. Correlation may require an irrational square root and is then labeled approximately. An exact zero variance produces an explicit undefined result, never a fabricated correlation of zero.

Centered products help avoid subtracting large nearly equal floating moments. Near-zero variance can still make a correlation numerically sensitive; displayed rounding must not decide whether the denominator is zero. For floating cross-checks, record the tolerance and keep theoretical weighted moments separate from sample estimators.

Engineering and ML connections

Correlation can detect redundant linear feature directions and covariance can describe the spread of paired quantities. Changing measurement units rescales covariance, while positive unit conversion leaves correlation fixed. A zero-variance feature needs an explicit standardization policy.

Feature screening by correlation alone can discard a predictive nonlinear relationship. Observational associations also need a causal model or experimental design before they justify an intervention; a signed coefficient is not that justification.

Exercises

Use exact fractions for moments and covariance, and explain the denominator whenever correlation is undefined.

calculation

Recover the canonical association

For weights [1,1,0; 1,2,1; 0,1,1] on U,V ∈ {−1,0,1}, give E[U], E[V], Cov(U,V), and correlation ρ.

prediction

Reflect, scale, and shift

The canonical U,V have means 0, variances 1/2, covariance 1/4. Set X = −2U + 3 and Y = 3V − 1. Give E[X], E[Y], Var(X), Var(Y), Cov(X,Y), and ρ(X,Y).

calculation

Include the cross term

For canonical U,V with variances 1/2 and covariance 1/4, give Var(U + V).

explanation

Zero correlation can hide dependence

U is uniform on {−1,0,1} and V = U². What follows?

Choose one answer

explanation

Separate collapse from a causal claim

Set X = 0U + 3 while retaining any valid V distribution. Which conclusion is justified?

Choose one answer

Summary and checkpoints

Covariance averages centered cross-products; correlation divides by positive standard deviations. Check the canonical 1/41/4 and 1/21/2, the signed affine scale laws, zero-scale collapse, the dependent zero-correlation example, and the limits of a causal interpretation.

The map of the book

97 of 97 chapters written · eight Parts

demo Foundation demo Try the live vector example Open as a page

Part I

Mathematical Language

The notation and mental objects everything else uses.

9 of 9 chapters written

  1. I.1 Scalars, quantities, units, powers and roots available
  2. I.2 Coordinates and points available
  3. I.3 Vectors: components, magnitude, and direction reference chapter available
  4. I.4 Algebraic expressions, equations and inequalities available
  5. I.5 Functions as input → transformation → output available
  6. I.6 Essential function families available
  7. I.7 Sets, intervals, and relations available
  8. I.8 Indexed quantities and summation available
  9. I.9 The notation map for ML available

Part II

Linear Algebra

Matrices as transformations: the strongest foundation in the book.

19 of 19 chapters written

  1. II.1 Vector addition and subtraction available
  2. II.2 Scalar multiplication and vector scaling available
  3. II.3 Norms, magnitude, and normalization available
  4. II.4 Dot product, angle, and orthogonality available
  5. II.5 Projection and distance to a direction available
  6. II.6 Linear combinations and span available
  7. II.7 Linear independence, basis, and coordinates available
  8. II.8 Matrices as linear transformations available
  9. II.9 Matrix × vector available
  10. II.10 Matrix × matrix as composition available
  11. II.11 Transpose and orthogonality available
  12. II.12 Determinant: orientation and area/volume scaling available
  13. II.13 Linear systems as intersecting constraints available
  14. II.14 Gaussian elimination and row operations available
  15. II.15 Rank and invertibility available
  16. II.16 Inverse matrices available
  17. II.17 Eigenvalues and eigenvectors available
  18. II.18 Orthogonal bases and least-squares geometry available
  19. II.19 Singular Value Decomposition available

Part III

Calculus

Change, local approximation, and sensitivity made visible.

15 of 15 chapters written

  1. III.1 Limits through approach available
  2. III.2 Continuity and local behavior available
  3. III.3 Derivative as secant → tangent available
  4. III.4 Derivative as rate of change and local linear model available
  5. III.5 Derivative rules available
  6. III.6 Chain rule available
  7. III.7 Multivariable functions and partial derivatives available
  8. III.8 Gradient and directional derivatives available
  9. III.9 Jacobian available
  10. III.10 Computational graphs and automatic differentiation available
  11. III.11 Hessian and curvature available
  12. III.12 Integrals as accumulation available
  13. III.13 Fundamental derivative/integral connection available
  14. III.14 Numerical differentiation available
  15. III.15 Numerical integration available

Part IV

Probability

Uncertainty through sample spaces, evidence, and repetition.

16 of 16 chapters written

  1. IV.1 Random experiments, outcomes, and sample spaces available
  2. IV.2 Events and probability mass available
  3. IV.3 Counting and finite probability where needed available
  4. IV.4 Conditional probability as restricted sample space available
  5. IV.5 Independence available
  6. IV.6 Bayes' theorem as probability-mass update available
  7. IV.7 Random variables available
  8. IV.8 PMF, PDF, and CDF available
  9. IV.9 Bernoulli and Binomial distributions available
  10. IV.10 Uniform and Gaussian distributions available
  11. IV.11 Expectation available
  12. IV.12 Variance and standard deviation available
  13. IV.13 Joint, marginal, and conditional distributions available
  14. IV.14 Covariance and correlation available
  15. IV.15 Law of Large Numbers available
  16. IV.16 Central Limit Theorem available

Part V

Statistics

From observed data to estimates, intervals, and likelihood.

10 of 10 chapters written

  1. V.1 Data summaries: mean, median, mode available
  2. V.2 Spread: variance, standard deviation, robust interpretation available
  3. V.3 Population, sample, and sampling variability available
  4. V.4 Estimators and estimation available
  5. V.5 Confidence intervals through repeated sampling available
  6. V.6 Covariance matrices and multivariate spread available
  7. V.7 Regression fundamentals available
  8. V.8 Likelihood available
  9. V.9 Maximum Likelihood Estimation available
  10. V.10 Maximum A Posteriori estimation available

Part VI

Optimization

Learning as repeated parameter updates governed by an objective.

10 of 10 chapters written

  1. VI.1 Objective functions and optimization landscapes available
  2. VI.2 Local vs global optima and stationary points available
  3. VI.3 Convexity available
  4. VI.4 Gradient descent flagship chapter available
  5. VI.5 Learning rate and convergence behavior available
  6. VI.6 Momentum available
  7. VI.7 Stochastic and mini-batch gradient descent available
  8. VI.8 Adam intuition available
  9. VI.9 Constraints and projected/penalized intuition available
  10. VI.10 Numerical stopping and optimization diagnostics available

Part VII

Information Theory

Logarithms, entropy, and the loss behind token prediction.

8 of 8 chapters written

  1. VII.1 Logarithms and log probabilities in computation available
  2. VII.2 Self-information available
  3. VII.3 Entropy available
  4. VII.4 Cross entropy and negative log-likelihood available
  5. VII.5 KL divergence available
  6. VII.6 Logits and softmax available
  7. VII.7 Numerical stability: log-sum-exp and stable softmax available
  8. VII.8 From token logits to language-model loss available

Part VIII

Numerical Computing

Why equivalent expressions behave differently on real machines.

10 of 10 chapters written

  1. VIII.1 Floating-point representation available
  2. VIII.2 Rounding and representation error available
  3. VIII.3 Error propagation and conditioning available
  4. VIII.4 Catastrophic cancellation available
  5. VIII.5 Overflow and underflow available
  6. VIII.6 Stable algorithms available
  7. VIII.7 Numerical linear algebra realities available
  8. VIII.8 Sparse matrices and sparse structure available
  9. VIII.9 Vectorized computation available
  10. VIII.10 Reproducibility, random seeds, and nondeterminism available