プリンキピア

第4章分類のための線形ニューラルネットワーク

4.6.1. The Test Set4.6.1 テスト集合

Since we have already begun to rely on test sets as the gold standard method for assessing generalization error, let’s get started by discussing the properties of such error estimates. Let’s focus on a fixed classifier f, without worrying about how it was obtained. Moreover suppose that we possess a fresh dataset of examples 𝒟=(𝐱(i),y(i))i=1n that were not used to train the classifier f. The empirical error of our classifier f on 𝒟 is simply the fraction of instances for which the prediction f(𝐱(i)) disagrees with the true label y(i), and is given by the following expression:
英語のヒント
汎化誤差を評価するための最も信頼できる方法として、すでにテスト集合に頼り始めているので、まずはこうした誤差の推定値の性質を論じることから始めよう。どのように得られたかは気にせず、固定した分類器fに注目しよう。さらに、分類器fの訓練には使われなかった、新しい事例のデータセット𝒟=(𝐱(i),y(i))i=1nをもっているとしよう。𝒟での分類器fの経験誤差は、単に、予測f(𝐱(i))が真のラベルy(i)と一致しないインスタンスの割合であり、次の式で与えられる。
ϵ𝒟(f)=1n∑i=1n𝟏(f(𝐱(i))≠y(i)).(4.6.1)
By contrast, the population error is the expected fraction of examples in the underlying population (some distribution P(X,Y) characterized by probability density function p(𝐱,y)) for which our classifier disagrees with the true label:
英語のヒント
これに対して、母集団誤差は、背後にある母集団(確率密度関数p(𝐱,y)で特徴づけられる、ある分布P(X,Y))の事例のうち、分類器が真のラベルと一致しないものの割合の期待値である。
ϵ(f)=E(𝐱,y)∼P𝟏(f(𝐱)≠y)=∫∫𝟏(f(𝐱)≠y)p(𝐱,y)d𝐱dy.(4.6.2)
While ϵ(f) is the quantity that we actually care about, we cannot observe it directly, just as we cannot directly observe the average height in a large population without measuring every single person. We can only estimate this quantity based on samples. Because our test set 𝒟 is statistically representative of the underlying population, we can view ϵ𝒟(f) as a statistical estimator of the population error ϵ(f). Moreover, because our quantity of interest ϵ(f) is an expectation (of the random variable 𝟏(f(X)≠Y)) and the corresponding estimator ϵ𝒟(f) is the sample average, estimating the population error is simply the classic problem of mean estimation, which you may recall from Section 2.6.
英語のヒント
ϵ(f)こそ実際に気にかける量だが、それを直接観測することはできない。大きな集団の平均身長を、一人残らず測らずには直接観測できないのと同じである。この量は標本にもとづいて推定することしかできない。テスト集合𝒟は背後にある母集団を統計的に代表しているので、ϵ𝒟(f)を母集団誤差ϵ(f)の統計的な推定量とみなせる。さらに、関心のある量ϵ(f)は(確率変数𝟏(f(X)≠Y)の)期待値であり、対応する推定量ϵ𝒟(f)は標本平均なので、母集団誤差の推定は、単に平均の推定という古典的な問題である。これは2.6節で扱ったので覚えているかもしれない。
An important classical result from probability theory called the central limit theorem guarantees that whenever we possess n random samples a1,...,an drawn from any distribution with mean μ and standard deviation σ, then, as the number of samples n approaches infinity, the sample average μˆ approximately tends towards a normal distribution centered at the true mean and with standard deviation σ/n. Already, this tells us something important: as the number of examples grows large, our test error ϵ𝒟(f) should approach the true error ϵ(f) at a rate of 𝒪(1/n). Thus, to estimate our test error twice as precisely, we must collect four times as large a test set. To reduce our test error by a factor of one hundred, we must collect ten thousand times as large a test set. In general, such a rate of 𝒪(1/n) is often the best we can hope for in statistics.
英語のヒント
中心極限定理と呼ばれる確率論の重要な古典的結果によれば、平均μ、標準偏差σのどんな分布から取り出したn個の無作為な標本a1,...,anがあるときでも、標本の数nが無限大に近づくにつれて、標本平均μˆはおおよそ、真の平均を中心とし標準偏差がσ/nの正規分布に近づいていく。これだけでもう、重要なことがわかる。事例の数が大きくなるにつれて、テスト誤差ϵ𝒟(f)は𝒪(1/n)の速さで真の誤差ϵ(f)に近づくはずである。したがって、テスト誤差を2倍の精度で推定するには、4倍の大きさのテスト集合を集めなければならない。テスト誤差を100分の1に減らすには、1万倍の大きさのテスト集合を集めなければならない。一般に、こうした𝒪(1/n)という速さは、統計学で望みうる最善であることが多い。
Now that we know something about the asymptotic rate at which our test error ϵ𝒟(f) converges to the true error ϵ(f), we can zoom in on some important details. Recall that the random variable of interest 𝟏(f(X)≠Y) can only take values 0 and 1 and thus is a Bernoulli random variable, characterized by a parameter indicating the probability that it takes value 1. Here, 1 means that our classifier made an error, so the parameter of our random variable is actually the true error rate ϵ(f). The variance σ2 of a Bernoulli depends on its parameter (here, ϵ(f)) according to the expression ϵ(f)(1−ϵ(f)). While ϵ(f) is initially unknown, we know that it cannot be greater than 1. A little investigation of this function reveals that our variance is highest when the true error rate is close to 0.5 and can be far lower when it is close to 0 or close to 1. This tells us that the asymptotic standard deviation of our estimate ϵ𝒟(f) of the error ϵ(f) (over the choice of the n test samples) cannot be any greater than 0.25/n.
英語のヒント
テスト誤差ϵ𝒟(f)が真の誤差ϵ(f)に収束する漸近的な速さについて少しわかったので、いくつかの重要な細部に目を寄せることができる。関心のある確率変数𝟏(f(X)≠Y)は値0と1しかとれず、したがってベルヌーイ確率変数であることを思い出してほしい。これは、値1をとる確率を示す一つのパラメータで特徴づけられる。ここで1は分類器が誤りを犯したことを意味するので、この確率変数のパラメータは、実は真の誤り率ϵ(f)である。ベルヌーイ分布の分散σ2は、そのパラメータ(ここではϵ(f))に依存し、式ϵ(f)(1−ϵ(f))で与えられる。ϵ(f)は最初は未知だが、1より大きくなりえないことはわかっている。この関数を少し調べると、分散は真の誤り率が0.5に近いときに最も大きく、0や1に近いときにははるかに小さくなりうることがわかる。このことから、(n個のテスト標本の選び方にわたる)誤差ϵ(f)の推定値ϵ𝒟(f)の漸近的な標準偏差は、0.25/nより大きくなりえないことがわかる。
If we ignore the fact that this rate characterizes behavior as the test set size approaches infinity rather than when we possess finite samples, this tells us that if we want our test error ϵ𝒟(f) to approximate the population error ϵ(f) such that one standard deviation corresponds to an interval of ±0.01, then we should collect roughly 2500 samples. If we want to fit two standard deviations in that range and thus be 95% confident that ϵ𝒟(f)∈ϵ(f)±0.01, then we will need 10,000 samples!
英語のヒント
この速さが表しているのは、有限の標本をもつときではなく、テスト集合の大きさが無限大に近づくときのふるまいだという事実を無視すれば、次のことがわかる。テスト誤差ϵ𝒟(f)が母集団誤差ϵ(f)を近似し、標準偏差一つ分が±0.01の区間に対応するようにしたいなら、およそ2500個の標本を集めるべきである。その範囲に標準偏差二つ分を収め、ϵ𝒟(f)∈ϵ(f)±0.01であると95%の確信をもちたいなら、10,000個の標本が必要になる!
This turns out to be the size of the test sets for many popular benchmarks in machine learning. You might be surprised to find out that thousands of applied deep learning papers get published every year making a big deal out of error rate improvements of 0.01 or less. Of course, when the error rates are much closer to 0, then an improvement of 0.01 can indeed be a big deal.
英語のヒント
これは、機械学習でよく使われる多くのベンチマークのテスト集合の大きさであることがわかる。誤り率の0.01以下の改善を大ごとのように扱う応用深層学習の論文が、毎年何千本も出版されていると知ったら驚くかもしれない。もちろん、誤り率が0にずっと近いときには、0.01の改善は実際に大ごとでありうる。
One pesky feature of our analysis thus far is that it really only tells us about asymptotics, i.e., how the relationship between ϵ𝒟 and ϵ evolves as our sample size goes to infinity. Fortunately, because our random variable is bounded, we can obtain valid finite sample bounds by applying an inequality due to Hoeffding (1963):
英語のヒント
これまでの分析の厄介な点の一つは、それが実は漸近的なふるまい、つまり標本の大きさが無限大に向かうにつれてϵ𝒟とϵの関係がどう変わるかについてしか教えてくれないことである。幸い、この確率変数は有界なので、Hoeffding(1963)による不等式を当てはめれば、有限の標本について正しい界を得られる。
P(ϵ𝒟(f)−ϵ(f)≥t)<exp⁡(−2nt2).(4.6.3)
Solving for the smallest dataset size that would allow us to conclude with 95% confidence that the distance t between our estimate ϵ𝒟(f) and the true error rate ϵ(f) does not exceed 0.01, you will find that roughly 15,000 examples are required as compared to the 10,000 examples suggested by the asymptotic analysis above. If you go deeper into statistics you will find that this trend holds generally. Guarantees that hold even in finite samples are typically slightly more conservative. Note that in the scheme of things, these numbers are not so far apart, reflecting the general usefulness of asymptotic analysis for giving us ballpark figures even if they are not guarantees we can take to court.
英語のヒント
推定値ϵ𝒟(f)と真の誤り率ϵ(f)の距離tが0.01を超えないと95%の確信をもって結論できる、最小のデータセットの大きさを求めると、上の漸近的な分析が示した10,000個に比べて、およそ15,000個の事例が必要になることがわかる。統計学をもっと深く学べば、この傾向が一般に成り立つことがわかる。有限の標本でも成り立つ保証は、ふつう少しだけ保守的である。大きな目で見れば、これらの数はそれほどかけ離れていないことに注意してほしい。これは、法廷に持ち込めるような保証ではないにしても、おおよその見当を与えるうえで漸近的な分析が一般に役立つことを表している。