バイアスと分散のトレードオフ
出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2022/04/15 15:33 UTC 版)
「機械学習」の記事における「バイアスと分散のトレードオフ」の解説
詳細は「偏りと分散」を参照 回帰では、入力xに対応するyの予測値 y ^ = F ^ D ( x ) {\displaystyle {\hat {\mathbf {y} }}={\hat {F}}_{D}(\mathbf {x} )} を出力する事を求められ、 y ^ {\displaystyle {\hat {\mathbf {y} }}} はyの期待値に近いことが望ましく、しかも y ^ {\displaystyle {\hat {\mathbf {y} }}} のばらつきは小さい方が望ましい。しかし下記に示すようにこの2つの要件はトレードオフの関係にある: 定理 (バイアスと分散のトレードオフ) ― p(x,y)を R ℓ × R k {\displaystyle \mathbb {R} ^{\ell }\times \mathbb {R} ^{k}} 上の確率分布とし、Dを R ℓ × R k {\displaystyle \mathbb {R} ^{\ell }\times \mathbb {R} ^{k}} 上の何らかの確率分布に従って選ばれた訓練データの集合とし、 F ^ {\displaystyle {\hat {F}}} を回帰アルゴリズムとし、Dによってこの回帰アルゴリズムを訓練して得られた関数を y ^ = F ^ D ( x ) {\displaystyle {\hat {\mathbf {y} }}={\hat {F}}_{D}(\mathbf {x} )} とし、誤差関数を自乗誤差 L ( y ^ , y ) = | | y ^ − y | | 2 {\displaystyle L({\hat {\mathbf {y} }},\mathbf {y} )=||{\hat {\mathbf {y} }}-\mathbf {y} ||^{2}} により定義し、さらに ( x , y ) ∼ p {\displaystyle (\mathbf {x} ,\mathbf {y} )\sim p} をDとは独立に選び、 y ¯ ( x ) = E y ∼ p | x [ y | x ] {\displaystyle {\bar {\mathbf {y} }}(\mathbf {x} )=E_{\mathbf {y} \sim p|_{\mathbf {x} }}[\mathbf {y} |\mathbf {x} ]} F ¯ ( x ) = E D [ F ^ D ( x ) ] {\displaystyle {\bar {F}}(\mathbf {x} )=E_{D}[{\hat {F}}_{D}(\mathbf {x} )]} とする。 このとき、予測誤差の訓練データ集合Dに関する期待値(期待予測誤差) E D [ E ( x , y ) ∼ p [ L ( F ^ D ( x ) , y ) ] = E ( x , y ) ∼ p , D [ | | F ^ D ( x ) − y | | 2 ] {\displaystyle E_{D}[E_{(\mathbf {x} ,\mathbf {y} )\sim p}[L({\hat {F}}_{D}(\mathbf {x} ),\mathbf {y} )]=E_{(\mathbf {x} ,\mathbf {y} )\sim p,D}[||{\hat {F}}_{D}(\mathbf {x} )-\mathbf {y} ||^{2}]} は以下を満たす: E ( x , y ) ∼ p , D [ | | F ^ D ( x ) − y | | 2 ] = V a r ( F ^ ) + B i a s 2 ( F ^ ) + N o i s e ( p ) {\displaystyle E_{(\mathbf {x} ,\mathbf {y} )\sim p,D}[||{\hat {F}}_{D}(\mathbf {x} )-\mathbf {y} ||^{2}]={\mathsf {Var}}({\hat {F}})+{\mathsf {Bias}}^{2}({\hat {F}})+{\mathsf {Noise}}(p)} ここで、 V a r ( F ^ ) = E x ∼ p | x , D ( | | F ^ D ( x ) − F ¯ ( x ) | | 2 ) {\displaystyle {\mathsf {Var}}({\hat {F}})=E_{\mathbf {x} \sim p|_{\mathbf {x} },D}(||{\hat {F}}_{D}(\mathbf {x} )-{\bar {F}}(\mathbf {x} )||^{2})} B i a s 2 ( F ^ ) = E x ∼ p | x ( | | F ¯ ( x ) − y ¯ ( x ) | | 2 ) {\displaystyle {\mathsf {Bias}}^{2}({\hat {F}})=E_{\mathbf {x} \sim p|_{\mathbf {x} }}(||{\bar {F}}(\mathbf {x} )-{\bar {\mathbf {y} }}(\mathbf {x} )||^{2})} N o i s e ( F ^ ) = E ( x , y ) ∼ p ( | | y ¯ ( x ) − y | | 2 ) {\displaystyle {\mathsf {Noise}}({\hat {F}})=E_{(\mathbf {x} ,\mathbf {y} )\sim p}(||{\bar {\mathbf {y} }}(\mathbf {x} )-\mathbf {y} ||^{2})} 証明 1 2 ( E ( x , y ) ∼ p , D [ | | F ^ D ( x ) − y | | 2 ] − V a r ( F ^ ) − B i a s 2 ( F ^ ) − N o i s e ( p ) ) = 1 2 E ( x , y ) ∼ p , D [ | | F ^ D ( x ) − y | | 2 − | | F ^ D ( x ) − F ¯ ( x ) | | 2 − | | F ¯ ( x ) − y ¯ ( x ) | | 2 − | | y ¯ ( x ) − y | | 2 ] = E ( x , y ) ∼ p , D [ − F ^ D ( x ) ⋅ y + F ^ D ( x ) ⋅ F ¯ ( x ) + F ¯ ( x ) ⋅ y ¯ ( x ) + y ¯ ( x ) ⋅ y − | | F ¯ ( x ) | | 2 − | | y ¯ ( x ) | | 2 ] = ( 1 ) {\displaystyle {\begin{aligned}&{1 \over 2}(E_{(\mathbf {x} ,\mathbf {y} )\sim p,D}[||{\hat {F}}_{D}(\mathbf {x} )-\mathbf {y} ||^{2}]-{\mathsf {Var}}({\hat {F}})-{\mathsf {Bias}}^{2}({\hat {F}})-{\mathsf {Noise}}(p))\\&={1 \over 2}E_{(\mathbf {x} ,\mathbf {y} )\sim p,D}[||{\hat {F}}_{D}(\mathbf {x} )-\mathbf {y} ||^{2}-||{\hat {F}}_{D}(\mathbf {x} )-{\bar {F}}(\mathbf {x} )||^{2}-||{\bar {F}}(\mathbf {x} )-{\bar {\mathbf {y} }}(\mathbf {x} )||^{2}-||{\bar {\mathbf {y} }}(\mathbf {x} )-\mathbf {y} ||^{2}]\\&=E_{(\mathbf {x} ,\mathbf {y} )\sim p,D}[-{\hat {F}}_{D}(\mathbf {x} )\cdot \mathbf {y} +{\hat {F}}_{D}(\mathbf {x} )\cdot {\bar {F}}(\mathbf {x} )+{\bar {F}}(\mathbf {x} )\cdot {\bar {\mathbf {y} }}(\mathbf {x} )+{\bar {\mathbf {y} }}(\mathbf {x} )\cdot \mathbf {y} -||{\bar {F}}(\mathbf {x} )||^{2}-||{\bar {\mathbf {y} }}(\mathbf {x} )||^{2}]=(1)\end{aligned}}} ここで E ( x , y ) ∼ p , D [ − F ^ D ( x ) ⋅ y + F ^ D ( x ) ⋅ F ¯ ( x ) ] = − E ( x , y ) ∼ p [ E D [ F ^ D ( x ) ] ⋅ y + E D [ F ^ D ( x ) ] ⋅ F ¯ ( x ) = E ( x , y ) ∼ p [ − F ¯ ( x ) ⋅ y + | | F ¯ ( x ) | | 2 ] {\displaystyle {\begin{aligned}&E_{(\mathbf {x} ,\mathbf {y} )\sim p,D}[-{\hat {F}}_{D}(\mathbf {x} )\cdot \mathbf {y} +{\hat {F}}_{D}(\mathbf {x} )\cdot {\bar {F}}(\mathbf {x} )]\\&=-E_{(\mathbf {x} ,\mathbf {y} )\sim p}[E_{D}[{\hat {F}}_{D}(\mathbf {x} )]\cdot \mathbf {y} +E_{D}[{\hat {F}}_{D}(\mathbf {x} )]\cdot {\bar {F}}(\mathbf {x} )\\&=E_{(\mathbf {x} ,\mathbf {y} )\sim p}[-{\bar {F}}(\mathbf {x} )\cdot \mathbf {y} +||{\bar {F}}(\mathbf {x} )||^{2}]\end{aligned}}} なので、 ( 1 ) = E ( x , y ) ∼ p [ − F ¯ ( x ) ⋅ y + F ¯ ( x ) ⋅ y ¯ ( x ) + y ¯ ( x ) ⋅ y − | | y ¯ ( x ) | | 2 ] = E ( x , y ) ∼ p [ ( F ¯ ( x ) − y ¯ ( x ) ) ( y ¯ ( x ) − y ) ] = E x [ ( F ¯ ( x ) − y ¯ ( x ) ) ( y ¯ ( x ) − E y ∼ p | x [ y ] ) ] = 0 {\displaystyle {\begin{aligned}(1)&=E_{(\mathbf {x} ,\mathbf {y} )\sim p}[-{\bar {F}}(\mathbf {x} )\cdot \mathbf {y} +{\bar {F}}(\mathbf {x} )\cdot {\bar {\mathbf {y} }}(\mathbf {x} )+{\bar {\mathbf {y} }}(\mathbf {x} )\cdot \mathbf {y} -||{\bar {\mathbf {y} }}(\mathbf {x} )||^{2}]\\&=E_{(\mathbf {x} ,\mathbf {y} )\sim p}[({\bar {F}}(\mathbf {x} )-{\bar {\mathbf {y} }}(\mathbf {x} ))({\bar {\mathbf {y} }}(\mathbf {x} )-\mathbf {y} )]\\&=E_{\mathbf {x} }[({\bar {F}}(\mathbf {x} )-{\bar {\mathbf {y} }}(\mathbf {x} ))({\bar {\mathbf {y} }}(\mathbf {x} )-E_{\mathbf {y} \sim p|_{\mathbf {x} }}[\mathbf {y} ])]\\&=0\end{aligned}}} 上では回帰の場合について述べたが、確信度を出力する分類でも同様である。
※この「バイアスと分散のトレードオフ」の解説は、「機械学習」の解説の一部です。
「バイアスと分散のトレードオフ」を含む「機械学習」の記事については、「機械学習」の概要を参照ください。
- バイアスと分散のトレードオフのページへのリンク