For full assigned coursework, complete all listed browser investigations, short numerical checks, exercise A, exercise B and the real-data case. Notebook completion recorded in the browser is a learner self-report; submit executed notebooks and evidence for review.
These short checks provide feedback for learning; answer before opening the worked feedback. A successful score on one fixed example does not establish general performance.
Write the unit, prediction time, target, population and loss contract before fitting.
Record disjoint row roles and compare the declared baseline/tree candidates on validation error counts.
Evaluate the frozen selected procedure and baseline on the 30 held-out rows.
Submit:
A five-field prediction contract and source-row split manifest.
Four-procedure training/validation risk ledger and deterministic tie rule.
A labelled 3 by 3 confusion matrix and risk = errors / 30.
A stated historical-sample limitation; no new-site generalization claim.
Short numerical checks
ch01-availability
At order acceptance, distance and quoted preparation time are already known. Actual dispatch time is recorded later. How many of these three features are admissible for that prediction?
Hint
Decide availability relative to the prediction event before looking at correlation.
Worked feedback — open after answering
Answer: 2
Two: distance and quoted preparation time. Actual dispatch time is post-outcome information for this contract. The full notebook also records the target, unit and evaluation population.
ch01-population-risk
For one fixed predictor, loss is 0 with probability 0.25 and 4 with probability 0.75. What is its population risk?
Hint
Weight each loss by its probability, then add.
Worked feedback — open after answering
Answer: 3
0.25 × 0 + 0.75 × 4 = 3. A particular two-row sample with losses 0 and 4 has empirical risk 2; that finite-sample average need not equal population risk.
ch01-dimension-mass
Three input coordinates are independent and uniform on [0,1]. What fraction lies in the lower-corner cube with side length 0.5? Enter a fraction, not a percentage.
Hint
The event requires all three independent coordinate inequalities.
Worked feedback — open after answering
Answer: 0.125
The mass is 0.5³ = 0.125. Among 80 independent observations the expected count is 10. With perfectly dependent identical coordinates the mass would instead be 0.5.
ch01-bias-variance
In a constructed setting with known truth, the mean fitted prediction is 2 and the conditional mean target is 1. Prediction variance is 0.5 and irreducible noise variance is 0.25. What is expected squared prediction error?
Hint
Square the difference of the two means; then add both variance terms.
Worked feedback — open after answering
Answer: 1.75
Squared bias is (2 − 1)² = 1. Total error is 1 + 0.5 + 0.25 = 1.75. This known-truth teaching fixture differs from the measured browser stability diagnostic, where true bias and noise are unknown.
Recover the declared Ridge system with an unpenalized intercept and stable solves.
Select from the four-candidate budget using complete training-only three-fold pipelines.
Report frozen final predictions and target-unit metrics for all declared procedures.
Submit:
Coefficient and objective-convention agreement.
A training-only CV ledger and frozen selection record.
Final prediction rows, MAE/RMSE/R squared and an explanation separating objective value from held-out performance.
Short numerical checks
ch02-train-scaling
A fitted training-only scaler has mean 10 and population standard deviation 2. A validation value is 14. What standardized value must the unchanged scaler produce?
Hint
Apply the training statistics unchanged to the validation value.
Worked feedback — open after answering
Answer: 2
z = (14 − 10) / 2 = 2. Re-estimating the mean or scale from validation values would change the fitted pipeline.
ch02-conditioning
A positive-definite quadratic Hessian has eigenvalues 100 and 1. What is its spectral condition number?
Hint
Divide the largest eigenvalue by the smallest.
Worked feedback — open after answering
Answer: 100
κ = 100 / 1 = 100. Full-gradient step stability is limited by the largest eigenvalue, while progress in the low-curvature direction can remain slow. Equal marginal scaling does not generally remove correlation.
ch02-gd-euler
For J(w) = (10/2)w², start at w = 1 and take one gradient-descent / forward-Euler step with eta = 0.3. What is the new w?
Hint
Differentiate this stated objective before applying w_new = w − eta × gradient.
Worked feedback — open after answering
Answer: -2
The gradient at 1 is 10, so w_new = 1 − 0.3 × 10 = −2. Loss rises from 5 to 20: the error multiplier is 1 − 0.3 × 10 = −2. For this scalar quadratic strict contraction needs 0 < eta < 0.2.
ch02-lasso-zero
For the scalar Lasso objective J(w) = 0.5(w − 0.8)² + |w|, what coefficient minimizes J?
Hint
Use the L1 soft-threshold rule or the zero-subgradient condition.
Worked feedback — open after answering
Answer: 0
Soft thresholding gives sign(0.8) × max(0.8 − 1, 0) = 0. Under the comparable Ridge objective 0.5(w − 0.8)² + 0.5w², the optimum is 0.4. Lasso can set an exact zero; Ridge generally shrinks continuously.
ch02-minibatch
At the SAME current parameter w = 1, three example gradients are 2, −1 and 5. Using their mean and eta = 0.1, what is the next mini-batch SGD parameter?
Hint
Average gradients evaluated at the same current parameter before making the one update.
Worked feedback — open after answering
Answer: 0.8
The mean gradient is (2 − 1 + 5) / 3 = 2. Thus w_new = 1 − 0.1 × 2 = 0.8. Summing without adjusting the learning rate or updating after each example describes a different step.
Recode malignant as positive and locate the fitted probability column by class identity.
Verify ROC AUC using positive–negative pairs with half credit for ties.
Compare ordinary/weighted models at four declared validation thresholds and freeze the selected policy.
Report final decision metrics separately from ranking/probability metrics.
Submit:
Explicit positive-class mapping and training-only fitted scaler statistics.
A verified manual pairwise AUC.
Eight-policy validation ledger and saved model/threshold choice.
Final confusion/cost tables, score rows and an explicit non-clinical limitation.
Short numerical checks
ch03-bce
For one positive target y = 1 and logit z = 0, what is binary cross-entropy using natural logarithms? Enter the loss to at least three decimal places.
Hint
At logit zero, sigmoid(z) is one half; use the negative logarithm of the assigned positive probability.
Worked feedback — open after answering
Answer: 0.6931471805599453
p = 0.5 and BCE = −ln(0.5) = ln(2) ≈ 0.693147. The stable logit form is logaddexp(0,z) − yz; it avoids taking logs of probabilities rounded to zero.
ch03-logistic-gradient
For one example x = 2, y = 1 with logit w*x + b, start at w = b = 0. Using the mean BCE objective and eta = 0.1, what is w after one simultaneous gradient step?
Hint
Compute p at the old weights, then use gradient_w = (p − y)x.
Worked feedback — open after answering
Answer: 0.1
At the old parameters p = 0.5, so gradient_w = (0.5 − 1) × 2 = −1. Thus w_new = 0 − 0.1 × (−1) = 0.1. The simultaneous bias update is b_new = 0.05; both gradients use the same old parameters.
ch03-confusion
A classifier yields TP = 6, FP = 2, FN = 4 and TN = 88. What is precision? Enter a fraction, not a percentage.
Hint
Precision conditions on predicted-positive cases.
Worked feedback — open after answering
Answer: 0.75
Precision = TP/(TP+FP) = 6/8 = 0.75. Recall is 6/10 = 0.6. Accuracy is 94/100 = 0.94, but an all-negative rule already has accuracy 0.90 in this imbalanced fixture.
ch03-cost
For those 100 cases (TP 6, FP 2, FN 4, TN 88), a false alarm costs 1 and a missed positive costs 5. What is mean cost per case?
Hint
Multiply each mistake count by its own cost, add, then divide by all 100 cases.
Worked feedback — open after answering
Answer: 0.22
Mean cost = (1 × 2 + 5 × 4) / 100 = 22/100 = 0.22. This policy calculation does not change fitted scores or ROC AUC. The costs are an illustrative teaching fixture.
ch03-auc-ties
Two positive scores are [0.8, 0.4] and two negative scores are [0.4, 0.2]. What is empirical ROC AUC when ties receive half credit?
Hint
Compare all four positive–negative score pairs.
Worked feedback — open after answering
Answer: 0.875
The 0.8 positive wins twice. The 0.4 positive ties 0.4 and beats 0.2, contributing 1.5 wins. AUC = (2 + 1.5) / 4 = 0.875. An action threshold can change costs but not this fixed-score ranking statistic.
Audit equal-size random and northward California Housing protocols and spatial cell groups.
Run the same four candidate pipelines under each protocol with fold-local preprocessing.
Evaluate each frozen selected procedure and mean-reference once.
Submit:
Source-row/fold manifests and eight candidate-by-protocol CV rows.
Dollar-unit MAE/RMSE, frozen predictions and two distinct population claims.
Short numerical checks
Fold-local preprocessing
A fold trains on values [2,4,6]. Its held-out value is 20. Using centering only, what transformed value must the held-out row receive?
Hint
Fit the mean on [2,4,6], not on all four values.
Worked feedback — open after answering
Answer: 16
The fold-training mean is 4, so the untouched held-out value becomes 20-4=16. Including 20 while fitting the mean would leak evaluation information.
Nested evaluation
A complete inner search is rerun inside each of three outer training folds. Their untouched outer errors are 0.30,0.24,0.27. What is their equally weighted mean error?
Hint
Average the outer results, not the best inner-search score.
Worked feedback — open after answering
Answer: 0.27
(0.30+0.24+0.27)/3=0.27. The outer folds evaluate the selection procedure. They do not turn the best inner score into an independent performance estimate.
Temporal boundaries
The prediction cutoff is time 10 and labels must be available strictly before it. Training rows occur at times [4,6,8] with reporting delays [1,3,3]. How many labels are eligible?
Hint
Add each row time to its reporting delay, then apply the strict cutoff.
Worked feedback — open after answering
Answer: 2
Availability times are [5,9,11]. Only the first two are strictly before 10. A fixed number of omitted rows does not by itself establish label availability.
Group separation
People A,B,C,D each have two rows. A row split places one row of every person in training and the other in validation. How many people cross the boundary?
Hint
Audit person IDs rather than checking only that row indices differ.
Worked feedback — open after answering
Answer: 4
All four people cross the boundary. To evaluate new-person prediction, the person-level overlap must be zero; disjoint row IDs alone are insufficient.
Deduplicate Red Wine Quality measurements before splitting while preserving source IDs.
Check PCA reconstruction identities without using targets to fit PCA.
Compare declared ridge/PCR/PLS pipelines using fold-local transformations.
Submit:
Retained source identities and the rank-zero/full-rank numerical checks.
Declared candidate table, selected frozen procedures and error in ordinal-score units.
Short numerical checks
PCA variance
Training covariance has eigenvalues [9,1,0]. What percentage of input variance does the first principal component retain?
Hint
Divide the retained eigenvalue by the sum of all eigenvalues, then multiply by 100.
Worked feedback — open after answering
Answer: 90
9/(9+1+0)=0.9, or 90%. This is an input-variance statement, not a guarantee about predicting a response.
PCA reconstruction
The fitted mean is [1,2], the retained unit direction is [1,0], and x=[4,6]. What is the squared reconstruction error?
Hint
Center x, project onto the retained direction, reconstruct, then compare with x.
Worked feedback — open after answering
Answer: 16
The centered row is [3,4], its score is 3, and the reconstruction is [4,2]. The residual is [0,4], so the squared error is 16.
Reconstruction versus prediction
On a balanced grid, u and v independently take values -1 and +1. Inputs are [10u,0.1v], target is v, and raw one-component PCA keeps the u direction. What is the training MSE of the best linear predictor using that retained score?
Hint
The retained score is uncorrelated with the zero-mean target. Its best linear prediction is the target mean.
Worked feedback — open after answering
Answer: 1
The best prediction is 0, so every squared target error is 1. PCA retains almost all input variance but loses the target-bearing coordinate. PLS can use the training response to identify that small direction.
t-SNE local evidence
For one displayed point, 6 of its 8 original-space nearest neighbors are also among its 8 display neighbors. What is the overlap fraction? Enter a decimal.
Hint
Count retained neighbors divided by the declared neighborhood size.
Worked feedback — open after answering
Answer: 0.75
6/8=0.75. This is one local overlap measurement. It is not classification accuracy, trustworthiness itself, or proof that visual islands are real populations.
t-SNE geometry
A computed embedding has trustworthiness 0.91. Rotate it, translate it and multiply every display coordinate by the same positive factor 7, without refitting. If there are no rank ties, what is its trustworthiness now?
Hint
These transformations preserve the order of pairwise display distances.
Worked feedback — open after answering
Answer: 0.91
It remains 0.91 because display-neighbor ranks are unchanged. Axes, origins and uniform display scale do not acquire physical meaning from the plot.
Reconstruct a binary linear SVM score and audit dual constraints.
Select among four scaling/classifier procedures with development-only folds.
Evaluate frozen multiclass Digit predictions and error types.
Submit:
Source splits, signed dual reconstruction and free-support residuals.
CV table, support/reference counts, final confusion matrix and image-level error gallery.
Short numerical checks
KNN voting
The three nearest training labels, in increasing distance order, are [0,1,1]. What class does an unweighted k=3 vote predict?
Hint
Count votes among exactly the selected three neighbors.
Worked feedback — open after answering
Answer: 1
Class 1 receives two votes and class 0 one vote. With k=1 the prediction would instead be 0; changing k changes the neighborhood rule.
Signed margin and hinge loss
For a binary SVM, y=-1 and decision score f(x)=-0.4. What is max(0,1-y*f(x))?
Hint
The signed margin is the product of the label and the score.
Worked feedback — open after answering
Answer: 0.6
The signed margin is 0.4, so hinge loss is 1-0.4=0.6. The class sign is correct, yet the point still violates the unit-margin requirement.
SVM dual feasibility
Two signed labels are [+1,-1] and unsigned dual coefficients are [0.2,0.2]. What is sum(alpha_i*y_i)?
Hint
Multiply each unsigned coefficient by its signed label before summing.
Worked feedback — open after answering
Answer: 0
0.2-0.2=0. The SVM dual requires this equality as well as 0<=alpha_i<=C; a free coefficient also requires signed margin approximately 1.
RBF similarity
The RBF kernel is exp(-gamma*squared_distance). With gamma=0.5 and squared distance 4, what is the kernel value? Round to at least five decimal places.
Hint
Compute exp(-0.5*4).
Worked feedback — open after answering
Answer: 0.1353352832366127
The exponent is -2, giving about 0.135335. Increasing gamma at the same distance decreases similarity; it does not produce a class probability.
SVR target units
An epsilon-SVR uses epsilon=0.2 and C=2. Multiply all target values by 1000 while keeping the input representation/kernel fixed. For the equivalent scaled primal problem, what epsilon is required?
Hint
Scale the error-tube width in the same units as the response.
Worked feedback — open after answering
Answer: 200
Epsilon becomes 200, and C must also become 2000. Scaling predictions, residual slack and weights by 1000 makes both primal terms share the same positive factor only with these corresponding parameter changes.
Fit mixed-type Adult preprocessing on training rows only and document excluded fields.
Compare a tree, randomized bagged trees and genuine boosted trees on the same partitions.
Report frozen prediction metrics and descriptive subgroup errors.
Submit:
Training-fitted medians/encoder categories, source partitions and excluded fields.
Three-model validation table, frozen selection, final confusion matrix and limited subgroup interpretations.
Short numerical checks
Regression stump gain
Targets [1,1,5,5] have parent mean 3. A split places [1,1] left and [5,5] right. What is parent SSE minus the two child SSEs?
Hint
Compute squared deviations around each node's own fitted mean.
Worked feedback — open after answering
Answer: 16
Parent SSE is 4+4+4+4=16. Both pure-valued child SSEs are zero, so the gain is 16. The split must still be selected using training observations only.
Out-of-bag eligibility
An original training row occurs [0,2,0] times in the three trees' bootstrap samples. How many trees may vote for that row's OOB prediction?
Hint
Only zero-occurrence trees are eligible; duplicates do not create held-out observations.
Worked feedback — open after answering
Answer: 2
Trees 1 and 3 omitted the row, so there are two eligible voters. Tree 2 saw its target and cannot contribute to this OOB prediction.
Forest versus bagging
There are 10 available features. A random-forest split considers a sampled subset of 3. How many features are excluded from that split's candidate search?
Hint
Subtract the sampled candidate count from the available count.
Worked feedback — open after answering
Answer: 7
10-3=7 features are excluded at that split. Bootstrap sampling alone is bagging; per-split feature subsampling supplies an additional diversity mechanism.
Sequential boosting
A current scalar prediction is 1. A fitted residual learner predicts 0.8 and the declared update is F_new=F_old+0.1*h. What is the updated prediction?
Hint
Use the learner output as an additive correction, not an independent vote.
Worked feedback — open after answering
Answer: 1.08
1+0.1*0.8=1.08. Boosting builds sequential corrections. Stage count and learning rate are selected from development evidence, not final-test errors.
Stacking leakage
A base model is fitted once using all four development targets, then predicts those same four rows for a stacking table. How many of those predictions are genuinely out of fold?
Hint
For each prediction ask whether its producing model had access to that row's target.
Worked feedback — open after answering
Answer: 0
Zero: the model saw every target. Construct each meta-feature using a model fitted without that row, check one held-out prediction per row/base learner, and refit bases only after the OOF table is complete.
Fit scaling/representation on Wine training rows and select K using label-free development evidence.
Inspect initialization stability and freeze a distance-alert threshold.
Use cultivar labels only for a final external agreement diagnostic.
Submit:
Source partitions, scaler means, K/stability table and frozen threshold.
Final assignments, cultivar ARI and alerts, with no claim that internal geometry proves semantic classes or faults.
Short numerical checks
Centroid update
Points [0,2,8,10] are assigned to initial centers [0,10]. After updating the two centers to their assigned means [1,9], what is total within-cluster SSE?
Hint
Measure each point around its assigned updated mean.
Worked feedback — open after answering
Answer: 4
The four squared deviations are 1,1,1,1, totaling 4. The previous centers gave SSE 8. A decrease follows this update but does not establish a global optimum.
Internal geometry
For a nonsingleton observation, mean within-cluster distance a=2 and nearest other-cluster mean distance b=5. What is its silhouette (b-a)/max(a,b)?
Hint
Use the larger of a and b in the denominator.
Worked feedback — open after answering
Answer: 0.6
(5-2)/5=0.6. It is an internal geometric diagnostic, not a probability of correct biological classification or proof of meaningful groups.
DBSCAN self-count
With minSamples=3, a point has exactly two other points within epsilon. Counting the point itself, is it a core point? Enter 1 for yes, 0 for no.
Hint
The epsilon-neighborhood includes the query point itself.
Worked feedback — open after answering
Answer: 1
There are 3 neighbors including itself, so it is core. A noncore border point can belong to a cluster but cannot expand a core-connectivity path.
Linkage distance
For one-dimensional groups A=[0,1] and B=[4,8], the four cross-group distances are [4,8,3,7]. What is average-linkage distance?
Hint
Average every cross-group pair distance.
Worked feedback — open after answering
Answer: 5.5
(4+8+3+7)/4=5.5. Single linkage would give 3, complete linkage 8. These are different merge rules, not different class-label accuracy formulas.
Anomaly versus drift
A baseline-only calibration has fixed an alert threshold of 4; a score must be strictly greater than 4 to alert. Fresh scores are [2,3,6,7]. What fraction of this batch alerts?
Hint
Apply the frozen threshold without refitting it on the fresh batch.
Worked feedback — open after answering
Answer: 0.5
Two of four scores exceed 4, giving 0.5. These are alerts, not confirmed faults. A dense novel group may not be DBSCAN noise, and four observations alone do not prove persistent distribution drift.
Keep fitting, calibration, policy-validation and final rows distinct.
Choose raw/recalibrated pipeline and hypothetical threshold on development only.
Report final proper scores, reliability-bin support and predeclared radius slices.
Submit:
WDBC split/source indices and selected frozen procedure.
Final probability scores, confusion, bin counts and slice denominators.
Short numerical checks
ch09-brier
Observed outcomes are [0, 1] and probabilities are [0.2, 0.8]. What is the mean Brier score?
Hint
Average the two squared probability errors.
Worked feedback — open after answering
Answer: 0.04
[(0.2−0)^2+(0.8−1)^2]/2 = (0.04+0.04)/2 = 0.04.
ch09-global-residual
Two equally sized groups have event frequencies 0.2 and 0.8. Every prediction is 0.5. What is the global mean residual E[Y−p]?
Hint
Average both group event frequencies before subtracting the report.
Worked feedback — open after answering
Answer: 0
The global event frequency is (0.2+0.8)/2=0.5, so the global residual is zero. The group residuals are −0.3 and +0.3, so cancellation does not establish conditional reliability.
ch09-conformal-rank
With 9 calibration residuals and alpha=0.2, what is the corrected split-conformal rank ceil((m+1)(1−alpha))?
Hint
Use m+1, not m; use the ceiling.
Worked feedback — open after answering
Answer: 8
ceil((9+1)×0.8)=8. If the corrected rank exceeds m, the ordinary finite residual list is insufficient and the threshold convention is +infinity.
Use measured Iris petal length to predict measured petal width with training-only transforms.
Compare maximum-variance acquisition with a declared source-order control.
Report fixed-budget results separately from any model-based uncertainty statement.
Submit:
Actual purchased source IDs and label budget.
Validation-selected kernel settings and final frozen error/interval report.
Short numerical checks
ch10-one-observation
A GP has prior variance 1 at a location, observation-noise variance 0.25 and zero prior mean. One response y=2 is observed there. What is the posterior mean at that same location?
Hint
Multiply y by prior variance divided by prior plus observation-noise variance.
Worked feedback — open after answering
Answer: 1.6
1/(1+0.25)×2=1.6. The remaining latent variance is 1−1/(1.25)=0.2.
ch10-observation-variance
Latent variance is 0.16 and assumed observation-noise SD is 0.3. What is the future-observation variance?
Hint
Square the noise SD before adding it.
Worked feedback — open after answering
Answer: 0.25
0.16+0.3²=0.25. The corresponding predictive SD is 0.5; variance and SD must not be interchanged.
ch10-ucb
For maximization, mean=0.4, SD=0.2 and kappa=2. What is UCB = mean+kappa×SD?
Hint
Use the standard deviation, not the variance.
Worked feedback — open after answering
Answer: 0.8
0.4+2×0.2=0.8. This seeks a high objective value; it is not the same rule as maximum-variance label acquisition.
ch10-zero-sd-ei
For maximization EI at zero posterior SD, mean=0.7, incumbent=0.5 and improvement offset=0.1. What is the deterministic EI limit?
Hint
At zero SD use max(mean−incumbent−offset,0).
Worked feedback — open after answering
Answer: 0.1
max(0.7−0.5−0.1,0)=0.1. Dividing by zero to form a standardized improvement would be incorrect.
Preserve official 20 Newsgroups train/test origins and declared metadata/duplicate filtering.
Verify an actual fitting-term document frequency and IDF without densifying the corpus.
Compare NB/logistic/linear-SVM on the same sparse features, select on validation, inspect final classwise errors once.
Submit:
Original source indices and filtering counts.
Observed-term IDF and three-classifier validation table.
Frozen final macro F1, accuracy, confusion and zero-feature count.
Short numerical checks
ch11-idf
There are 4 training documents and a term appears in 1 of them. What is smoothed IDF log((1+n)/(1+df))+1?
Hint
Use document frequency, not total token frequency.
Worked feedback — open after answering
Answer: 1.916290731874155
log(5/2)+1 ≈ 1.916291. These statistics must be fitted from training documents only.
ch11-nb-smoothing
A class contains 6 token occurrences, including 3 copies of a term. With vocabulary size 4 and alpha=1, what is that term’s smoothed conditional probability?
Hint
Add alpha to the term total and alpha×vocabulary size to the class total.
Worked feedback — open after answering
Answer: 0.4
(3+1)/(6+1×4)=4/10=0.4. The denominator must smooth every vocabulary term.
ch11-order-loss
Under one fixed unigram vocabulary, what is the Euclidean distance between count vectors for “dog bites man” and “man bites dog”?
Hint
Count the same three terms; unigram counts discard their order.
Worked feedback — open after answering
Answer: 0
Both vectors contain one dog, one bites and one man, so their distance is zero. Bigrams can preserve different adjacent pairs.
ch11-macro-f1
Two classes have F1 scores 0.9 and 0.5. What is macro F1?
Hint
Give each class equal weight.
Worked feedback — open after answering
Answer: 0.7
(0.9+0.5)/2=0.7. Aggregate accuracy can conceal the weaker class; inspect the confusion matrix too.
Preserve original MNIST train/test origins and the declared 3-versus-8 subset.
Implement all scalar-MSE derivatives and three directional finite-difference checks on actual image rows.
Train a bounded mini-batch run, compare a ridge affine control, copy validation state and evaluate final two-class performance once.
Submit:
9433 parameters and actual-image directional error table.
Copied checkpoint, same-fitting-data baseline and retained source indices.
Frozen test MSE/thresholded accuracy/confusion without a calibrated-probability claim.
Short numerical checks
ch12-bias-gradient
For one example, an unrestricted scalar prediction is 0.1 and the target is 0.4. What is the output-bias derivative of squared error?
Hint
Differentiate (prediction−target)² with respect to the output intercept.
Worked feedback — open after answering
Answer: -0.6
2×(0.1−0.4)=−0.6. For a batch mean, the example contributions receive one 1/n factor.
ch12-sgd
The output bias is 0.1, its gradient is−0.6 and learning rate is 0.1. What is its plain-SGD updated value?
Hint
Subtract learning rate times gradient.
Worked feedback — open after answering
Answer: 0.16
0.1−0.1×(−0.6)=0.16. All parameter updates must use gradients from their declared current state.
ch12-weighted-loss
Batch means are 0.4,0.5,0.9 for counts 64,64,22. What is the sample-weighted trajectory mean?
Hint
Recover the three loss totals, then divide by 150.
Worked feedback — open after answering
Answer: 0.516
(64×0.4+64×0.5+22×0.9)/150=0.516, not 0.6. A trajectory mean still differs from a frozen-model loss.
ch12-checkpoint
Validation losses at epochs 1,2,3,4 are 0.6,0.4,0.45,0.5. Patience 2 stops after epoch 4. Which copied epoch should the declared best-validation rule return?
Hint
Stopping time and selected predictor need not coincide.
Worked feedback — open after answering
Answer: 2
Epoch 2 has the smallest validation loss. Epoch 4 is the executed stopping epoch; test losses do not choose either rule.