ArticleslgStudy

computer science

Early stopping

Early stopping is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Early stopping rather than just read about it. In short: In machine learning, early stopping is a form of regularization used to avoid overfitting when training a model with an iterative method, such as gradient descent. Such methods update the model to make it better fit the training data with each iteration.

Early stopping — main illustration
Early stopping — illustration

Key takeaways

  • Early stopping belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Early stopping to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Early stopping from memory before moving on to harder problems.

Reference excerpt

In machine learning, early stopping is a form of regularization used to avoid overfitting when training a model with an iterative method, such as gradient descent. Such methods update the model to make it better fit the training data with each iteration. Up to a point, this improves the model's performance on data outside of the training set (e.g., the validation set). Past that point, however, improving the model's fit to the training data comes at the expense of increased generalization error. Early stopping rules provide guidance as to how many iterations can be run before the learner begins to over-fit. Early stopping rules have been employed in many different machine learning methods, with varying amounts of theoretical foundation.

Background This section presents some of the basic machine-learning concepts required for a description of early stopping methods.

Overfitting

Machine learning algorithms train a model based on a finite set of training data. During this training, the model is evaluated based on how well it predicts the observations contained in the training set. In general, however, the goal of a machine learning scheme is to produce a model that generalizes, that is, that predicts previously unseen observations. Overfitting occurs when a model fits the data in the training set well, while incurring larger generalization error.

Regularization

Regularization, in the context of machine learning, refers to the process of modifying a learning algorithm so as to prevent overfitting. This generally involves imposing some sort of smoothness constraint on the learned model. This smoothness may be enforced explicitly, by fixing the number of parameters in the model, or by augmenting the cost function as in Tikhonov regularization. Tikhonov regularization, along with principal component regression and many other regularization schemes, fall under the umbrella of spectral regularization, regularization characterized by the application of a filter. Early stopping also belongs to this class of methods.

Gradient descent methods

Gradient descent methods are first-order, iterative, optimization methods. Each iteration updates an approximate solution to the optimization problem by taking a step in the direction of the negative of the gradient of the objective function. By choosing the step-size appropriately, such a method can be made to converge to a local minimum of the objective function. Gradient descent is used in machine-learning by defining a loss function that reflects the error of the learner on the training set and then minimizing that function.

Early stopping based on analytical results

Early stopping in statistical learning theory Early-stopping can be used to regularize non-parametric regression problems encountered in statistical learning theory. For a given input space, X, output space, Y, and samples drawn from an unknown probability measure, ρ, on Z=X×Y, the goal of such problems is to approximate a regression function, fρ, given by

fρ(x)=∫Yydρ(y∣x),x∈X, where ρ(y∣x) is the conditional distribution at x induced by ρ. One common choice for approximating the regression function is to use functions from a reproducing kernel Hilbert space. These spaces can be infinite dimensional, in which they can supply solutions that overfit training sets of arbitrary size. Regularization is, therefore, especially important for these methods. One way to regularize non-parametric regression problems is to apply an early stopping rule to an iterative procedure such as gradient descent. The early stopping rules proposed for these problems are based on analysis of upper bounds on the generalization error as a function of the iteration number. They yield prescriptions for the number of iterations to run that can be computed prior to starting the solution process.

Example: Least-squares loss (Adapted from Yao, Rosasco and Caponnetto, 2007) Let X⊆ℝn and Y=ℝ. Given a set of samples

𝐳={(xi,yi)∈X×Y:i=1,…,m}∈Zm, drawn independently from ρ, minimize the functional

ℰ(f)=∫X×Y(f(x)−y)2dρ where, f is a member of the reproducing kernel Hilbert space ℋ. That is, minimize the expected risk for a Least-squares loss function. Since ℰ depends on the unknown probability measure ρ, it cannot be used for computation. Instead, consider the following empirical risk

ℰ𝐳(f)=1m∑i=1m(f(xi)−yi)2. Let ft and ft𝐳 be the t-th iterates of gradient descent applied to the expected and empirical risks, respectively, where both iterations are initialized at the origin, and both use the step size γt. The ft form the population iteration, which converges to fρ, but cannot be used in computation, while the ft𝐳 form the sample iteration which usually converges to an overfitting solution. We want to control the difference between the expected risk of the sample iteration and the minimum expected risk, that is, the expected risk of the regression function:

ℰ(ft𝐳)−ℰ(fρ) This difference can be rewritten as the sum of two terms: the difference in expected risk between the sample and population iterations and that between the population iteration and the regression function:

ℰ(ft𝐳)−ℰ(fρ)=[ℰ(ft𝐳)−ℰ(ft)]+[ℰ(ft)−ℰ(fρ)] This equation presents a bias-variance tradeoff, which is then solved to give an optimal stopping rule that may depend on the unknown probability distribution. That rule has associated probabilistic bounds on the generalization error. For the analysis leading to the early stopping rule and bounds, the reader is referred to the original article. In practice, data-driven methods, e.g. cross-validation can be used to obtain an adaptive stopping rule.

Early stopping in boosting Boosting refers to a family of algorithms in which a set of weak learners (learners that are only slightly correlated with the true process) are combined to produce a strong learner. It has been shown, for several boosting algorithms (including AdaBoost), that regularization via early stopping can provide guarantees of consistency, that is, that the result of the algorithm approaches the true solution as the number of samples goes to infinity.

L2-boosting Boosting methods have close ties to the gradient descent methods described above can be regarded as a boosting method based on the L2 loss: L2Boost.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Early stopping

Start with the simplest possible case. Write down what Early stopping claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Early stopping before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Early stopping ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Early stopping

In research
Early stopping appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Early stopping in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Early stopping is common in secondary-school and first-year university syllabi. It links to neighbouring topics Artificial neural networks, so understanding it makes those chapters shorter.
In everyday life
Look for Early stopping outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Early stopping” →

How to study Early stopping in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Early stopping means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Early stopping out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Early stopping in simple terms?

In machine learning, early stopping is a form of regularization used to avoid overfitting when training a model with an iterative method, such as gradient descent. Such methods update the model to make it better fit the training data with each iteration.

Why does Early stopping matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Early stopping?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Early stopping.

Tags

  • Artificial neural networks

Keep exploring