プリンキピア

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

4.7.1. Types of Distribution Shift4.7.1 分布シフトの種類

To begin, we stick with the passive prediction setting considering the various ways that data distributions might shift and what might be done to salvage model performance. In one classic setup, we assume that our training data was sampled from some distribution pS(𝐱,y) but that our test data will consist of unlabeled examples drawn from some different distribution pT(𝐱,y). Already, we must confront a sobering reality. Absent any assumptions on how pS and pT relate to each other, learning a robust classifier is impossible.
英語のヒント
まずは受動的な予測の設定にとどまり、データの分布が変わりうるさまざまなあり方と、モデルの性能を救うために何ができるかを考える。古典的な設定の一つでは、訓練データはある分布pS(𝐱,y)から標本抽出されたが、テストデータは別の分布pT(𝐱,y)から取り出されたラベルのない事例からなると仮定する。すでにここで、酔いもさめるような現実に向き合わなければならない。pSとpTが互いにどう関係するかについて何の仮定もなければ、頑健な分類器を学習するのは不可能である。
Consider a binary classification problem, where we wish to distinguish between dogs and cats. If the distribution can shift in arbitrary ways, then our setup permits the pathological case in which the distribution over inputs remains constant: pS(𝐱)=pT(𝐱), but the labels are all flipped: pS(y∣𝐱)=1−pT(y∣𝐱). In other words, if God can suddenly decide that in the future all “cats” are now dogs and what we previously called “dogs” are now cats—without any change in the distribution of inputs p(𝐱), then we cannot possibly distinguish this setting from one in which the distribution did not change at all.
英語のヒント
犬と猫を見分けたい二値分類の問題を考えよう。分布が任意のやり方で変わりうるなら、この設定では、入力にわたる分布は一定のまま(pS(𝐱)=pT(𝐱))なのに、ラベルがすべて反転する(pS(y∣𝐱)=1−pT(y∣𝐱))という病的な場合も許される。言い換えれば、もし神が突然、これからはすべての「猫」は犬であり、以前「犬」と呼んでいたものは猫であると決められるなら、しかも入力の分布p(𝐱)には何の変化もないなら、この設定を、分布がまったく変わらなかった設定と見分けることはとてもできない。
Fortunately, under some restricted assumptions on the ways our data might change in the future, principled algorithms can detect shift and sometimes even adapt on the fly, improving on the accuracy of the original classifier.
英語のヒント
幸い、データが将来どう変わりうるかについて何らかの制限された仮定を置けば、筋の通ったアルゴリズムはシフトを検出でき、ときにはその場で適応して、元の分類器の正解率を上回ることさえできる。

4.7.1.1. Covariate Shift4.7.1.1 共変量シフト

Among categories of distribution shift, covariate shift may be the most widely studied. Here, we assume that while the distribution of inputs may change over time, the labeling function, i.e., the conditional distribution P(y∣𝐱) does not change. Statisticians call this covariate shift because the problem arises due to a shift in the distribution of the covariates (features). While we can sometimes reason about distribution shift without invoking causality, we note that covariate shift is the natural assumption to invoke in settings where we believe that 𝐱 causes y.
英語のヒント
分布シフトの種類のなかで、共変量シフトはおそらく最も広く研究されてきた。ここでは、入力の分布は時間とともに変わりうるが、ラベル付けの関数、つまり条件付き分布P(y∣𝐱)は変わらないと仮定する。統計学者がこれを共変量シフトと呼ぶのは、共変量(特徴量)の分布のシフトのせいで問題が生じるからである。因果関係をもち出さなくても分布シフトについて推論できることもあるが、𝐱がyを引き起こすと考えられる設定では、共変量シフトはもち出すのが自然な仮定であることを指摘しておく。
Consider the challenge of distinguishing cats and dogs. Our training data might consist of images of the kind in Fig. 4.7.1.
英語のヒント
猫と犬を見分けるという課題を考えよう。訓練データは、図4.7.1のような種類の画像からなるかもしれない。
Image omitted because its reuse rights could not be verified.権利の確認ができないため画像を割愛。
Fig. 4.7.1図4.7.1
Training data for distinguishing cats and dogs (illustrations: Lafeez Hossain / 500px / Getty Images; ilkermetinkursova / iStock / Getty Images Plus; GlobalP / iStock / Getty Images Plus; Musthafa Aboobakuru / 500px / Getty Images).
英語のヒント
猫と犬を見分けるための訓練データ(図版:Lafeez Hossain / 500px / Getty Images; ilkermetinkursova / iStock / Getty Images Plus; GlobalP / iStock / Getty Images Plus; Musthafa Aboobakuru / 500px / Getty Images)。
At test time we are asked to classify the images in Fig. 4.7.2.
英語のヒント
テストのときには、図4.7.2の画像を分類するよう求められる。
Image omitted because its reuse rights could not be verified.権利の確認ができないため画像を割愛。
Fig. 4.7.2図4.7.2
Test data for distinguishing cats and dogs (illustrations: SIBAS_minich / iStock / Getty Images Plus; Ghrzuzudu / iStock / Getty Images Plus; id-work / DigitalVision Vectors / Getty Images; Yime / iStock / Getty Images Plus).
英語のヒント
猫と犬を見分けるためのテストデータ(図版:SIBAS_minich / iStock / Getty Images Plus; Ghrzuzudu / iStock / Getty Images Plus; id-work / DigitalVision Vectors / Getty Images; Yime / iStock / Getty Images Plus)。
The training set consists of photos, while the test set contains only cartoons. Training on a dataset with substantially different characteristics from the test set can spell trouble absent a coherent plan for how to adapt to the new domain.
英語のヒント
訓練集合は写真からなるのに、テスト集合には漫画しか含まれていない。テスト集合と大きく異なる特徴をもつデータセットで訓練すると、新しい領域にどう適応するかについて筋の通った計画がなければ、厄介なことになりかねない。

4.7.1.2. Label Shift4.7.1.2 ラベルシフト

Label shift describes the converse problem. Here, we assume that the label marginal P(y) can change but the class-conditional distribution P(𝐱∣y) remains fixed across domains. Label shift is a reasonable assumption to make when we believe that y causes 𝐱. For example, we may want to predict diagnoses given their symptoms (or other manifestations), even as the relative prevalence of diagnoses are changing over time. Label shift is the appropriate assumption here because diseases cause symptoms. In some degenerate cases the label shift and covariate shift assumptions can hold simultaneously. For example, when the label is deterministic, the covariate shift assumption will be satisfied, even when y causes 𝐱. Interestingly, in these cases, it is often advantageous to work with methods that flow from the label shift assumption. That is because these methods tend to involve manipulating objects that look like labels (often low-dimensional), as opposed to objects that look like inputs, which tend to be high-dimensional in deep learning.
英語のヒント
ラベルシフトは、逆の問題を表す。ここでは、ラベルの周辺分布P(y)は変わりうるが、クラスで条件づけた分布P(𝐱∣y)は領域をまたいで固定されたままだと仮定する。ラベルシフトは、yが𝐱を引き起こすと考えられるときに置くのが妥当な仮定である。たとえば、診断の相対的な有病率が時間とともに変わっていくなかでも、症状(やそのほかの現れ)から診断を予測したいことがある。病気が症状を引き起こすので、ここではラベルシフトが適切な仮定である。縮退したいくつかの場合には、ラベルシフトと共変量シフトの仮定が同時に成り立ちうる。たとえば、ラベルが決定論的であれば、yが𝐱を引き起こすときでさえ、共変量シフトの仮定は満たされる。興味深いことに、こうした場合には、ラベルシフトの仮定から導かれる手法を使うほうが有利であることが多い。それは、こうした手法では、深層学習では高次元になりがちな、入力のように見える対象ではなく、ラベルのように見える(多くの場合低次元の)対象を操作することになりがちだからである。

4.7.1.3. Concept Shift4.7.1.3 概念シフト

We may also encounter the related problem of concept shift, which arises when the very definitions of labels can change. This sounds weird—a cat is a cat, no? However, other categories are subject to changes in usage over time. Diagnostic criteria for mental illness, what passes for fashionable, and job titles, are all subject to considerable amounts of concept shift. It turns out that if we navigate around the United States, shifting the source of our data by geography, we will find considerable concept shift regarding the distribution of names for soft drinks as shown in Fig. 4.7.3.
英語のヒント
関連する問題として、概念シフトに出会うこともある。これは、ラベルの定義そのものが変わりうるときに生じる。奇妙に聞こえるだろう。猫は猫ではないか、と。しかし、ほかのカテゴリーは、時とともに言葉の使われ方が変わることがある。精神疾患の診断基準、流行りとして通用するもの、職名は、どれもかなりの概念シフトを受ける。実は、アメリカ合衆国のあちこちを回り、データの出どころを地理的にずらしていくと、図4.7.3に示すように、清涼飲料の呼び名の分布にかなりの概念シフトが見つかる。
Fig. 4.7.3図4.7.3
Concept shift for soft drink names in the United States (CC-BY: Alan McConchie, PopVsSoda.com).
英語のヒント
アメリカ合衆国における清涼飲料の呼び名の概念シフト(CC-BY: Alan McConchie, PopVsSoda.com)。
If we were to build a machine translation system, the distribution P(y∣𝐱) might be different depending on our location. This problem can be tricky to spot. We might hope to exploit knowledge that shift only takes place gradually either in a temporal or geographic sense.
英語のヒント
機械翻訳のシステムを作るとしたら、分布P(y∣𝐱)は場所によって違うかもしれない。この問題は見つけるのが厄介なことがある。シフトは時間的な意味でも地理的な意味でも徐々にしか起きない、という知識を活用したいところである。