Skip to content

Data, Models, and Learning

Part I built the mathematics. This chapter is the vocabulary you need before any of it can be pointed at a dataset — and the book is unusually careful here, because three of the words involved mean more than one thing.

The chapter’s own framing: there are three components of a machine learning system — data, models and learning — and the guiding question is “what do we mean by good models?” The answer the book commits to is that good models perform well on unseen data, which sounds obvious and turns out to drive everything in §8.2 onward.

  • Why “data as vectors” is a sequence of modelling decisions, not a formatting step — reconstructed from the book’s Tables 8.1 and 8.2.
  • Measured: latitude and salary in Table 8.2 differ in spread by a factor of 297,010, which is why the book’s advice to standardise every column exists.
  • Equation 8.2, a model as a function, and the trick of Equations 8.4–8.5 that turns an affine model into a linear one.
  • Section 8.1.3, a model as a distribution, and precisely what extra question that lets you ask.
  • The book’s own running example fitted: θ=(8.807355, 2.122453)\theta = (8.807355,\ 2.122453), f(60)=136.154562f(60) = 136.154562 with a residual scale of 25.60319925.603199.
  • Section 8.1.4’s three algorithmic phases, and the naming collision the book explicitly warns about.
  • Which chapter answers which phase, so the rest of Part II has a map.

Intuition: three problems wearing one word

Section titled “Intuition: three problems wearing one word”

“Data” sounds like something you are given. It is not. Between the spreadsheet a domain expert hands you and the matrix XRN×D\mathbf{X} \in \mathbb{R}^{N\times D} that an algorithm consumes, somebody makes half a dozen irreversible choices. Table 8.1 to Table 8.2 in the book is exactly that transition, and this page counts the choices.

“Model” means two different things, and the book is explicit that it will “revisit it multiple times”. A model can be a function — feed it features, get a number — or a distribution, which describes how likely each answer is. Both appear in this chapter; the first drives §8.2, the second §8.3 and §8.4.

“Learning” means three different things, depending on which phase you are in. Predicting is not training and training is not model selection, and they consume different slices of your data.

diagram Section 8.1, and where each thread goes mermaid

The book’s assumption is that data is tabular and tidy (Wickham, 2014; Codd, 1990): each row is an example, each column is a feature. It also states plainly what it is not going to cover — identifying good features, which “depend on domain expertise and require careful engineering”.

But even given a tidy table, getting to numbers takes decisions. Here is Table 8.1 as the book prints it:

NameGenderDegreePostcodeAgeAnnual salary
AdityaMMScW21BG3689563
BobMPhDEC1A1BA47123543
ChloéFBEconSW1A1BH2623989
DaisukeMBScSE207AT68138769
ElisabethFMBASE10AA33113888

and here is Table 8.2, the numerical version:

Gender IDDegreeLatitudeLongitudeAgeAnnual Salary (thousands)
1-1251.50730.12903689.563
1-1351.50740.127547123.543
+1+1151.50710.12782623.989
1-1151.50750.128168138.769
+1+1251.50740.127833113.888

Four decisions happened. Each is defensible and each is a claim about the world:

  1. The Name column was dropped. The book gives two reasons: it is not expected to be informative, and dropping it anonymises the row. Note these are different kinds of reason — one is about prediction, the other about ethics, and they happen to agree here.
  2. Gender became 1-1 / +1+1. The book explicitly notes 00 / 11 would also do. That choice is invisible to an unregularised linear model and not invisible to a regularised one, since it changes what “a large coefficient” means.
  3. Degree became 11 / 22 / 33. This asserts an order — bachelor’s, master’s, PhD — and simultaneously asserts that BEcon == BSc and MBA == MSc. Both are domain claims, and the encoding also asserts that the step from 11 to 22 equals the step from 22 to 33.
  4. Postcode became a latitude and longitude. This one needs actual knowledge: that “SE10AA” is not a string but a place in London.
  • NN examples, indexed n=1,,Nn = 1, \dots, N. Each example xn\mathbf{x}_n is a DD-dimensional vector.
  • DD features, indexed d=1,,Dd = 1, \dots, D.
  • Supervised learning means each example carries a label yny_n — also called a target, response variable, or annotation.
  • The dataset is {(x1,y1),,(xN,yN)}\{(\mathbf{x}_1, y_1), \dots, (\mathbf{x}_N, y_N)\}, and the examples stack into XRN×D\mathbf{X} \in \mathbb{R}^{N\times D}.

The book flags that this row-per-example orientation “originates from the database community”, and that Chapter 10 will find it more convenient to treat examples as columns. Worth knowing before you hit a transpose that looks wrong.

A predictor is a function that takes a feature vector and returns an output. Taking the output to be a real scalar:

f:RDRf : \mathbb{R}^D \to \mathbb{R}

The book restricts to linear functions, and says why: it strikes “a good balance between the generality of the problems that can be solved and the amount of background mathematics that is needed”. So:

f(x)=θx+θ0f(\mathbf{x}) = \boldsymbol\theta^\top\mathbf{x} + \theta_0

for unknown θ\boldsymbol\theta and θ0\theta_0. Chapters 2 and 3 are enough to state this precisely — no functional analysis required.

§8.1.3 Models as probability distributions

Section titled “§8.1.3 Models as probability distributions”

The motivation is one sentence: data is usually noisy observations of some true underlying effect, and we would like predictors that “express some sort of uncertainty”. Chapter 6 is the language for that.

So instead of a single function, consider a distribution over possible outputs. The book restricts to distributions with finite-dimensional parameters, which is what lets it avoid stochastic processes and random measures, and notes that even this “already allow[s] for a rich class of models”.

The practical difference is exactly one question. With a function you can ask “what is the prediction at x=60x = 60?” With a distribution you can also ask “how confident is that?” — and get an answer that is a number rather than a feeling.

The goal: find a model and its parameters such that the resulting predictor does well on unseen data. Three conceptually distinct phases:

  1. Prediction or inference — apply a trained predictor to new data. Model and parameters are fixed.
  2. Training or parameter estimation — adjust the model using training data.
  3. Hyperparameter tuning or model selection — choose among models.

For training there are two strategies, and this split organises the rest of the chapter:

  • Find a point estimate. One best parameter vector. Works for both kinds of predictor. §8.2 (empirical risk minimization) and §8.3 (maximum likelihood, MAP).
  • Bayesian inference. Keep a whole distribution over parameters. Needs a probabilistic model. §8.4.

Fit the book’s own data. Table 8.2’s two rightmost columns are age and salary:

x=(36, 47, 26, 68, 33),y=(89.563, 123.543, 23.989, 138.769, 113.888)x = (36,\ 47,\ 26,\ 68,\ 33), \qquad y = (89.563,\ 123.543,\ 23.989,\ 138.769,\ 113.888)

Step 1: build the design matrix. Using the unit-feature trick with D=1D = 1:

Φ=[136147126168133]\boldsymbol\Phi = \begin{bmatrix}1 & 36\\ 1 & 47\\ 1 & 26\\ 1 & 68\\ 1 & 33\end{bmatrix}

Step 2: the normal equations. The least-squares solution satisfies ΦΦθ=Φy\boldsymbol\Phi^\top\boldsymbol\Phi\,\boldsymbol\theta = \boldsymbol\Phi^\top\mathbf{y}. With N=5N = 5, xn=210\sum x_n = 210 so xˉ=42\bar{x} = 42, and xn2=1296+2209+676+4624+1089=9894\sum x_n^2 = 1296 + 2209 + 676 + 4624 + 1089 = 9894:

ΦΦ=[52102109894]\boldsymbol\Phi^\top\boldsymbol\Phi = \begin{bmatrix}5 & 210\\ 210 & 9894\end{bmatrix}

The determinant is 5×98942102=4947044100=53705 \times 9894 - 210^2 = 49470 - 44100 = 5370. And yn=489.752\sum y_n = 489.752, xnyn=22703.093\sum x_n y_n = 22703.093, so

θ=15370[98942102105][489.75222703.093]=[8.8073552.122453]\boldsymbol\theta = \frac{1}{5370}\begin{bmatrix}9894 & -210\\ -210 & 5\end{bmatrix}\begin{bmatrix}489.752\\ 22703.093\end{bmatrix} = \begin{bmatrix}8.807355\\ 2.122453\end{bmatrix}

Step 3: read it. The slope is 2.1224532.122453 thousand per year of age, and the intercept is 8.8073558.807355 thousand — a notional salary at age zero, which is why intercepts are usually not worth interpreting.

Step 4: predict at 60.

f(60)=8.807355+2.122453×60=136.154562f(60) = 8.807355 + 2.122453 \times 60 = 136.154562

Step 5: the same fit as a distribution. The residuals are

yΦθ,empirical risk=1Nnrn2=655.523816\mathbf{y} - \boldsymbol\Phi\boldsymbol\theta, \qquad \text{empirical risk} = \frac1N\sum_n r_n^2 = 655.523816

so the residual standard deviation is 655.523816=25.603199\sqrt{655.523816} = 25.603199. The distributional answer at age 6060 is N(136.1546, 25.60322)\mathcal{N}(136.1546,\ 25.6032^2), giving a one-standard-deviation interval of [110.551, 161.758][110.551,\ 161.758] and a two-standard-deviation interval of [84.948, 187.361][84.948,\ 187.361].

That interval is enormous — nearly ±40%\pm 40\% — and it should be, from five data points. The function view returns 136.154562136.154562 and says nothing. That difference is the entire content of §8.1.3.

The four encoding decisions are easier to feel than to read about. Change one and watch what the model can and cannot then express:

sketch Four decisions, and what each one costs you p5.js
Step through the four encoding decisions that turn Table 8.1 into Table 8.2. Each panel shows what the column looked like before, what it becomes, and what information is now unrecoverable. The last knob toggles column standardisation and reports the spread ratio it fixes.
data_models_learning.py
import numpy as np
 
# Table 8.1, exactly as the book prints it.
RAW = [
    ("Aditya",    "M", "MSc",   "W21BG",   36,  89563),
    ("Bob",       "M", "PhD",   "EC1A1BA", 47, 123543),
    ("Chloe",     "F", "BEcon", "SW1A1BH", 26,  23989),
    ("Daisuke",   "M", "BSc",   "SE207AT", 68, 138769),
    ("Elisabeth", "F", "MBA",   "SE10AA",  33, 113888),
]
 
# The four decisions that produce Table 8.2.
GENDER = {"M": -1, "F": +1}                      # decision 2
DEGREE = {"BSc": 1, "BEcon": 1, "MSc": 2, "MBA": 2, "PhD": 3}   # decision 3
POSTCODE = {                                     # decision 4, domain knowledge
    "W21BG":   (51.5073, 0.1290),
    "EC1A1BA": (51.5074, 0.1275),
    "SW1A1BH": (51.5071, 0.1278),
    "SE207AT": (51.5075, 0.1281),
    "SE10AA":  (51.5074, 0.1278),
}
 
rows = []
for name, g, deg, pc, age, salary in RAW:      # decision 1: drop the name
    lat, lon = POSTCODE[pc]
    rows.append([GENDER[g], DEGREE[deg], lat, lon, age, salary / 1000.0])
X_full = np.array(rows)
print("Table 8.2 reconstructed, shape", X_full.shape)
for r in X_full:
    print("  [%+d, %d, %.4f, %.4f, %d, %.3f]"
          % (r[0], r[1], r[2], r[3], r[4], r[5]))
 
# --- N and D, and the supervised split ------------------------------------
N, D = X_full.shape[0], X_full.shape[1] - 1
print(f"\nN = {N} examples, D = {D} features (salary is the label y)")
x = X_full[:, 4]                                  # age
y = X_full[:, 5]                                  # salary in thousands
 
# --- Equation 8.2: a predictor as a function ------------------------------
# Concatenate a unit feature so the affine model is a linear one (Eq 8.4/8.5).
Phi = np.column_stack([np.ones(N), x])
theta = np.linalg.lstsq(Phi, y, rcond=None)[0]
print(f"\ntheta = [{theta[0]:.6f}, {theta[1]:.6f}]   "
      f"(intercept, slope per year)")
pred60 = theta @ np.array([1.0, 60.0])
print(f"f(60) = {pred60:.6f}")
resid = y - Phi @ theta
print(f"empirical risk (Eq 8.6, squared loss) = {np.mean(resid ** 2):.6f}")
print(f"residual standard deviation           = "
      f"{np.sqrt(resid @ resid / N):.6f}")
 
# --- Section 8.1.3: the same predictor as a distribution -----------------
sigma = np.sqrt(resid @ resid / N)
print(f"\nas a distribution: p(y | x=60) = N({pred60:.4f}, {sigma:.4f}^2)")
for k in (1, 2):
    print(f"  {k} sd interval: [{pred60 - k * sigma:8.3f}, "
          f"{pred60 + k * sigma:8.3f}]")
print("with five data points the honest interval is very wide, which is")
print("exactly the information the function view discards.")
 
# --- the book's own advice: standardise every column ---------------------
print("\nSection 8.1.1's advice, applied to all six columns:")
mu, sd = X_full.mean(axis=0), X_full.std(axis=0)
Z = (X_full - mu) / sd
names = ["gender", "degree", "latitude", "longitude", "age", "salary"]
print(f"{'column':>10} {'raw mean':>12} {'raw sd':>12} "
      f"{'scaled mean':>13} {'scaled sd':>11}")
for k, nm in enumerate(names):
    print(f"{nm:>10} {mu[k]:>12.6f} {sd[k]:>12.6f} "
          f"{Z[:, k].mean():>13.2e} {Z[:, k].std():>11.6f}")
print("\nlatitude had a spread of %.6f and salary %.4f -- a ratio of %.0f."
      % (sd[2], sd[5], sd[5] / sd[2]))
print("Any penalty on the size of theta treats those two as comparable")
print("unless the columns are scaled first, which is why the advice exists.")
text
Table 8.2 reconstructed, shape (5, 6)
  [-1, 2, 51.5073, 0.1290, 36, 89.563]
  [-1, 3, 51.5074, 0.1275, 47, 123.543]
  [+1, 1, 51.5071, 0.1278, 26, 23.989]
  [-1, 1, 51.5075, 0.1281, 68, 138.769]
  [+1, 2, 51.5074, 0.1278, 33, 113.888]
 
N = 5 examples, D = 5 features (salary is the label y)
 
theta = [8.807355, 2.122453]   (intercept, slope per year)
f(60) = 136.154562
empirical risk (Eq 8.6, squared loss) = 655.523816
residual standard deviation           = 25.603199
 
as a distribution: p(y | x=60) = N(136.1546, 25.6032^2)
  1 sd interval: [ 110.551,  161.758]
  2 sd interval: [  84.948,  187.361]
with five data points the honest interval is very wide, which is
exactly the information the function view discards.
 
Section 8.1.1's advice, applied to all six columns:
    column     raw mean       raw sd   scaled mean   scaled sd
    gender    -0.200000     0.979796     -4.44e-17    1.000000
    degree     1.800000     0.748331     -8.88e-17    1.000000
  latitude    51.507340     0.000136      1.11e-17    1.000000
 longitude     0.128040     0.000516      2.15e-14    1.000000
       age    42.000000    14.656057      2.22e-17    1.000000
    salary    97.950400    40.288419     -2.89e-16    1.000000
 
latitude had a spread of 0.000136 and salary 40.2884 -- a ratio of 297010.
Any penalty on the size of theta treats those two as comparable
unless the columns are scaled first, which is why the advice exists.
figure Turning a table into vectors is a sequence of modelling decisions matplotlib
Two stacked tables. Above, Table 8.1 with string and categorical columns, annotated that none of it is directly usable. Below, Table 8.2 in numerical form, with the four encoding decisions listed alongside: name dropped, gender to minus one and plus one, degree to an ordinal, postcode to latitude and longitude. Two stacked tables. Above, Table 8.1 with string and categorical columns, annotated that none of it is directly usable. Below, Table 8.2 in numerical form, with the four encoding decisions listed alongside: name dropped, gender to minus one and plus one, degree to an ordinal, postcode to latitude and longitude.
Each of the four decisions is a claim about the world, and each is irreversible downstream. Nothing later can recover the postcode from a latitude, or learn that an MBA is not an MSc.
figure One fit, two kinds of answer matplotlib
Two panels sharing the same five data points and the same fitted line. Left, an amber square marks the single prediction 136.15 at age 60. Right, a Gaussian density drawn sideways at age 60 with its one and two standard deviation marks, spanning roughly 85 to 187. Two panels sharing the same five data points and the same fitted line. Left, an amber square marks the single prediction 136.15 at age 60. Right, a Gaussian density drawn sideways at age 60 with its one and two standard deviation marks, spanning roughly 85 to 187.
The function view returns 136.154562 and stops. The distribution view returns the same mean with a standard deviation of 25.603199, so its two-sigma interval spans 84.9 to 187.4 — which is the honest answer from five points.
figure Section 8.1.4's three phases, and what is fixed in each matplotlib
Three stacked boxes, innermost at the bottom. Prediction, with everything fixed. Training, with the model class fixed and the parameters free. Model selection, with the model class itself free. Each box lists its alternative name, what it needs, and which chapter covers it. Three stacked boxes, innermost at the bottom. Prediction, with everything fixed. Training, with the model class fixed and the parameters free. Model selection, with the model class itself free. Each box lists its alternative name, what it needs, and which chapter covers it.
The three phases consume different slices of the data and are all called learning. The book warns explicitly that the word inference is used for at least two of them.

The first figure counts what a data-loading script actually does. Look at the “lost” column of the four decisions rather than the “why” column. Decision 1 loses nothing predictive. Decision 2 loses nothing at all — until a regulariser appears, at which point the choice between {1,+1}\{-1, +1\} and {0,1}\{0, 1\} changes the geometry of the penalty. Decision 3 loses the most: it asserts a total order on degrees and an equal spacing and two specific equalities (BEcon == BSc, MBA == MSc), and none of those is recoverable later. Decision 4 loses the postcode, and could only be made by someone who knew what a postcode is.

The point is not that any of these is wrong. It is that they are decisions, and a table of numbers carries no record of having been decided. By the time the data reaches §8.2 it looks like a given.

The second figure is §8.1.2 against §8.1.3 on identical numbers. Same five points, same line, θ=(8.807355, 2.122453)\boldsymbol\theta = (8.807355,\ 2.122453). On the left the answer at age 6060 is 136.154562136.154562 — a number with no error bar and no way to attach one, because a function has no vocabulary for doubt.

On the right the answer is a Gaussian with the same mean and standard deviation 25.60319925.603199. Look at how wide that is: the two-sigma interval runs from 84.94884.948 to 187.361187.361, more than a factor of two from bottom to top. That is not a defect of the distributional view — it is the truth about a fit to five points, and the function view’s crisp 136.154562136.154562 was hiding it. Which of the two you want depends entirely on whether anything downstream is going to make a decision with the number.

One honest note on the residual scale: I computed it as rn2/N\sqrt{\sum r_n^2 / N} with N=5N = 5, the maximum likelihood estimate that §8.3.1 will derive. It is biased low, because it divides by NN rather than by N2N - 2 for the two fitted parameters. Using N2N - 2 gives 33.05358833.053588, an even wider interval. The point stands either way, and gets stronger.

The third figure is the map for the rest of Part II. Read it from the bottom up, because that is the order of increasing freedom: at prediction time everything is fixed; at training time the parameters move but the model class does not; at model-selection time the class itself moves. Each layer wraps the one below, which is exactly why §8.6.1’s nested cross-validation has two loops — one per layer of freedom.

The naming note in the caption is not pedantry. If a paper says “inference took 4 ms”, that is phase 1. If it says “variational inference”, that is phase 2. The book’s own remark that there is “no agreed upon naming” is the safest thing to carry.

model as a functionmodel as a distribution
the objectf:RDRf : \mathbb{R}^D \to \mathbb{R}p(yx,θ)p(y \mid \mathbf{x}, \boldsymbol\theta)
the book§8.1.2, Eq 8.2§8.1.3
answer at x=60x = 60136.154562136.154562N(136.1546, 25.60322)\mathcal{N}(136.1546,\ 25.6032^2)
can express uncertaintynoyes
trained byempirical risk minimization, §8.2maximum likelihood or Bayes, §8.3, §8.4
regularisation appears asa penalty term, §8.2.3a prior, §8.3.2
needs a noise modelnoyes
prediction is calledpredictioninference
phasewhat is fixedwhat is freedata it consumeswhere
prediction / inferencemodel and parametersthe input onlyone unseen pointCh 9–12
training / parameter estimationthe model classthe parametersthe training set§8.2, §8.3, §8.4
model selectionnothingthe class and hyperparameterstraining + validation§8.6
pch.quizTag Do you know what the vocabulary is hiding?
  1. Table 8.2 encodes Degree as 1, 2, 3. What does that assert?

    pch.quizShowAnswer

    B — An order on degrees, an equal spacing between consecutive levels, and that BEcon equals BSc and MBA equals MSc — An ordinal encoding is three claims at once and all of them are domain claims. None is recoverable from the numbers afterwards, and nothing will flag them — a linear model will simply behave as though the step from bachelor to master equals the step from master to doctorate.

  2. Why does the book advise standardising every column to zero mean and unit variance?

    pch.quizShowAnswer

    B — Because a penalty on the size of theta treats all coefficients as comparable, and Table 8.2's column spreads differ by a factor of 297010 — Latitude has standard deviation 0.000136 and salary 40.288419. An isotropic penalty on theta would effectively forbid the model from using latitude while barely constraining salary. Conditioning also improves, but the regularisation argument is the one that changes the answer rather than the speed.

  3. What exactly does the unit-feature trick of Equations 8.4 and 8.5 buy, and what does it cost?

    pch.quizShowAnswer

    B — It turns an affine model into a linear one so matrix algebra applies — at the cost that a norm penalty on theta now shrinks the intercept too — Appending a constant feature makes theta-transpose x identical to the affine form, which is what lets the whole of Chapters 2 and 3 apply. The side effect is that theta-0 is now an ordinary coefficient, so the L2 penalty of Section 8.2.3 shrinks it — and there is rarely a reason to prefer a small intercept.

  4. The fit to Table 8.2 gives f(60) = 136.154562 with residual standard deviation 25.603199. What is the honest reading?

    pch.quizShowAnswer

    B — The point prediction is 136.15 but the two-sigma interval spans 84.9 to 187.4, so the estimate is barely informative — The width is not a defect, it is the truth about a two-parameter fit to five points — and dividing by N minus 2 rather than N makes it wider still, at 33.054. The function view's crisp 136.154562 was concealing exactly this.

  5. In the book's terminology, what does 'inference' most often mean?

    pch.quizShowAnswer

    B — Prediction with a probabilistic model — but the book warns there is no agreed convention and it is also used for parameter estimation — Section 8.1.4 states verbatim that there is no agreed naming: inference usually means prediction with a probabilistic model, is sometimes used for parameter estimation, and occasionally for prediction with a non-probabilistic one. Three phases share the word, and the ambiguity survives into library APIs.

Exercise 2 – Fit the book’s own example

Section titled “Exercise 2 – Fit the book’s own example”

Exercise 3 – Why standardisation matters

Section titled “Exercise 3 – Why standardisation matters”

Exercise 4 – A function cannot express doubt

Section titled “Exercise 4 – A function cannot express doubt”

Exercise 5 – The intercept is not a quantity

Section titled “Exercise 5 – The intercept is not a quantity”
  • Three components: data, models, learning. The guiding question is “what do we mean by good models?”, and the book’s answer is that good models perform well on UNSEEN data.
  • Data as vectors is a sequence of decisions, not a format conversion. Table 8.1 to Table 8.2 takes four: drop the name, encode gender as minus one and plus one, encode degree as an ordinal 1 / 2 / 3, and turn a postcode into a latitude and longitude.
  • The degree encoding carries the most content: it asserts an order, an equal spacing, and that BEcon equals BSc and MBA equals MSc. None of that is recoverable from the numbers.
  • Standardise every column, because a penalty on the size of theta treats all coefficients as comparable. Measured on Table 8.2, the widest and narrowest column spreads differ by a factor of 297010.
  • N examples indexed by n, D features indexed by d, examples stacked as ROWS in X. Chapter 10 switches to columns, so a surprising transpose is often just that.
  • Equation 8.2 is a model as a function, restricted to linear ones because that keeps the required mathematics inside Chapters 2 and 3.
  • The unit-feature trick, Equations 8.4 and 8.5, appends a constant feature so the affine model becomes linear. The cost: the intercept is now an ordinary coefficient and an L2 penalty shrinks it, which you almost never want.
  • Section 8.1.3 is a model as a distribution, and it buys exactly one thing: the question “how confident are you?” becomes answerable.
  • The book’s own example fitted: theta is (8.807355, 2.122453), f(60) is 136.154562, and the residual scale is 25.603199 — so the two-sigma interval at age 60 spans 84.9 to 187.4, or 75 percent of the prediction. Figure 8.2’s line is illustrative, not this fit.
  • An intercept is not a quantity. Centring the input turns 8.807355 into 97.950400, which is the mean salary — same model, same slope, same predictions.
  • Three algorithmic phases: prediction (everything fixed), training (parameters free), model selection (the class free). They consume different slices of the data and Section 8.6.1’s nested cross-validation has one loop per layer.
  • Two training strategies: find a point estimate (Sections 8.2, 8.3) or do Bayesian inference (Section 8.4). Only the second needs a probabilistic model.
  • “Inference” is ambiguous and the book says so. It usually means prediction with a probabilistic model, sometimes parameter estimation, occasionally prediction with a non-probabilistic model.

Next: the first of the two frameworks — learning without ever writing down a probability. Empirical Risk Minimization

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading