第3章回帰のための線形ニューラルネットワーク
3.7. Weight Decay3.7 重み減衰
Now that we have characterized the problem of overfitting, we can introduce our first regularization technique. Recall that we can always mitigate overfitting by collecting more training data. However, that can be costly, time consuming, or entirely out of our control, making it impossible in the short run. For now, we can assume that we already have as much high-quality data as our resources permit and focus the tools at our disposal when the dataset is taken as a given.
英語のヒント
過学習の問題を特徴づけたので、最初の正則化技術を紹介できる。訓練データをもっと集めれば、いつでも過学習を和らげられることを思い出そう。しかし、それには費用がかかったり、時間がかかったり、まったく手に負えなかったりして、短期的には不可能なこともある。今は、資源が許すかぎりの質の高いデータがすでにあると仮定し、データセットが所与のものとして与えられたときに使える道具に焦点を当てる。
Recall that in our polynomial regression example (Section 3.6.2.1) we could limit our model’s capacity by tweaking the degree of the fitted polynomial. Indeed, limiting the number of features is a popular technique for mitigating overfitting. However, simply tossing aside features can be too blunt an instrument. Sticking with the polynomial regression example, consider what might happen with high-dimensional input. The natural extensions of polynomials to multivariate data are called monomials, which are simply products of powers of variables. The degree of a monomial is the sum of the powers. For example, , and are both monomials of degree 3.
英語のヒント
多項式回帰の例(3.6.2.1節)では、当てはめる多項式の次数を調整することで、モデルの容量を制限できたことを思い出そう。実際、特徴量の数を制限することは、過学習を和らげるよく使われる技術である。しかし、特徴量を単に捨ててしまうのは、道具として粗すぎることがある。多項式回帰の例のまま、高次元の入力で何が起きうるかを考えよう。多項式を多変量のデータへ自然に拡張したものを単項式といい、これは単に変数のべき乗の積である。単項式の次数は、べき指数の和である。たとえばとは、どちらも次数3の単項式である。
Note that the number of terms with degree blows up rapidly as grows larger. Given variables, the number of monomials of degree is . Even small changes in degree, say from to , dramatically increase the complexity of our model. Thus we often need a more fine-grained tool for adjusting function complexity.
英語のヒント
が大きくなるにつれて、次数の項の数が急速に膨れ上がることに注意してほしい。個の変数が与えられたとき、次数の単項式の数はである。次数のわずかな変化、たとえばからへの変化でさえ、モデルの複雑さを劇的に増やす。そこで、関数の複雑さを調整するための、もっときめ細かな道具が必要になることが多い。
%matplotlib inline
import torch
from torch import nn
from d2l import torch as d2l