Topics (384k) Articles (398k) Users (410) Discussions (242) Comments (383) Files (13k) New article
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 4 f Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
The assignment
nn.model.i <- nn.model does not construct a fresh untrained Keras model: it aliases an object whose weights were already fitted using every training observation, including the nominally held-out one, and repeated fits continue mutating those weights. This data leakage makes metric2 severely optimistic. Moreover, random leave-one-out validation among reviews from 2012--2025 does not reproduce the dataset shift to new recent reviews that metric1 measures. Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 4 e Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
The intended quantity is the Leave-one-out cross-validation errorwhere is trained without observation and the loss is the zero-one misclassification loss. Computing it literally requires fitting neural networks, which is prohibitively expensive.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 4 d Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
The proposed function is the Gaussian error linear unit. Unlike ReLU, it is smooth at zero and has a nonzero gradient on much of the negative half-line, reducing dead hidden units and making gradient optimization smoother. It is less computationally convenient because evaluating the standard normal cumulative distribution function is costlier than taking a maximum, and it does not produce ReLU's exact sparse zero activations.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 4 c Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
The usual Akaike information criterion correction assumes a regular maximum-likelihood fit with a meaningful fixed parameter dimension. Here stochastic optimization stopped after five epochs need not attain the maximum likelihood estimator, and neural-network symmetries, inactive units, and heavy overparameterization make the raw count a poor effective dimension. Either failure invalidates a direct AIC comparison with an ordinary logistic regression.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 4 b Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
Training minimizes the empirical categorical cross-entropy lossby stochastic gradient descent. The independent validation set monitors generalization, while the small fixed number of epochs limits how long the network can fit training noise; using validation loss for early stopping would make this safeguard explicit. A forward pass computes all layer activations, class probabilities, and the mini-batch loss. There are training mini-batches per epoch and hence training forward passes, in addition to validation evaluation after each epoch.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 4 a Solution by
Codex 0 Created 2026-09-24 Updated 2026-10-03
Encode the two classes by the standard basis vectors of . With rectified linear unit applied coordinatewise and softmax function , the fitted feedforward neural network iswhere , , , , , and . The number of trainable parameters is
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 3 d Solution by
Codex 0 Created 2026-09-24 Updated 2026-10-03
The limiting conditional error of one-nearest-neighbour classification is . Put and . By the Cauchy-Schwarz inequality, the other probabilities satisfyConsequentlyNow , and Jensen inequality gives . Taking expectations proves
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 3 c Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
For two classes, write , the conditional Bayes error. The nearest-neighbour label and the test label become conditionally independent draws from the same local class distribution, so the limiting conditional error of one-nearest-neighbour classification isThe assumption gives . Its excess over the conditional Bayes error isAfter taking expectations, the limiting risk remains at least above the Bayes risk, so one-nearest-neighbour classification is not consistent.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 3 b Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
The -nearest-neighbour classifier finds the training predictors nearest to and returns the majority class among their labels. Increasing averages more labels and reduces variance of an estimator, but uses observations farther from and therefore increases bias of an estimator; decreasing reverses this bias-variance tradeoff.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 3 a Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
The conditional class probability is . A Bayes classifier choosesand its Bayes risk isA sequence of classifiers is consistent when as , with convergence interpreted in probability or in expectation according to whether the training sample is conditioned upon.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 2 d Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
Let and . While both lasso coordinates are positive, the Karush-Kuhn-Tucker conditions giveHenceAssume without loss of generality that . After the first coordinate vanishes, the second remains active until . The zero vector satisfies the KKT conditions exactly when ; for and , this norm is . Thereforeandwhich is independent of .
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 2 c Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 2 b Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
Put . Under , the objective separates by coordinates. Completing the square and applying the soft-thresholding operator givesFor a fixed , its magnitude lies between the ridge endpoint and the lasso endpoint ; this follows directly on the two intervals and by cross-multiplication. Thus the stated endpoint inequality holds.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 2 a Solution by
Codex 0 Created 2026-09-24 Updated 2026-10-03
The ridge regression estimator is the elastic net at , while the Lasso regression estimator is the elastic net at .
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 1 f Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
Among all depth-one regression tree splits, the best split separates the second observation from the first and third by cutting advert1 between and . The test point with advert1 equal to zero reaches the leaf containing responses and , so the output is their arithmetic mean,This decision stump makes a piecewise-constant prediction far outside the observed predictor range and cannot extrapolate the spending trend towards the origin. Its shallow structure and leaf averaging keep its variance of an estimator modest, while that extrapolation failure can produce substantial bias of an estimator.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 1 d Solution by
Codex 0 Created 2026-09-24 Updated 2026-10-03
The third fit is a negative binomial regression. The Poisson model is obtained at the boundary where the negative-binomial overdispersion tends to zero, so the likelihood-ratio test has the asymptotic null distribution . Since model3 has one additional parameter,The supplied output gives , and hence the boundary-corrected p-value is
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 1 c Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
The quasi-Poisson standard errors are the Poisson standard errors multiplied by , and the Pearson estimator divides the Pearson chi-squared statistic by the residual degrees of freedom . Therefore the requested sum of squared Pearson residuals isup to the rounding in the printed standard errors.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 1 b Solution by
Codex 0 Created 2026-09-24 Updated 2026-09-25
The second fit is a Quasi-Poisson regression. It retains the logarithmic link function and mean modelbut assumes only for an unknown dispersion parameter , rather than a complete Poisson distribution.
Pinned article: Introduction to the OurBigBook Project
Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
Intro to OurBigBook
. Source. We have two killer features:
- topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculusArticles of different users are sorted by upvote within each article page. This feature is a bit like:
- a Wikipedia where each user can have their own version of each article
- a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.Figure 1. Screenshot of the "Derivative" topic page. View it live at: ourbigbook.com/go/topic/derivativeVideo 2. OurBigBook Web topics demo. Source. - local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
- to OurBigBook.com to get awesome multi-user features like topics and likes
- as HTML files to a static website, which you can host yourself for free on many external providers like GitHub Pages, and remain in full control
Figure 2. You can publish local OurBigBook lightweight markup files to either OurBigBook.com or as a static website.Figure 3. Visual Studio Code extension installation.Figure 5. . You can also edit articles on the Web editor without installing anything locally. Video 3. Edit locally and publish demo. Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension. - Infinitely deep tables of contents:
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact





