0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ソフトマックス関数を使った事後確率の表現

Posted at

$D$次元特徴ベクトル$\textbf{x}_i$について、$N$種の入力値を$\mathrm{X}=(\textbf{x}_1,\textbf{x}_2,\ldots,\textbf{x}_N)$と書く。このデータが得られた上で、$\textbf{x}_i$に対応の入力に対し、モデルがクラス$C_k$に属する確率は$P(C_k|\textbf{x}_i)$であり、これを条件付き確率と言う。

ベイズの定理と確率の乗法定理によって

\displaystyle{P(C_k|\textbf{x}_i)=\frac{P(\textbf{x}_i|C_k)P(C_k)}{P(\textbf{x}_i)}}=\frac{P(\textbf{x}_i|C_k)P(C_k)}{\displaystyle{\sum_{j=1}^k} P(\textbf{x}_i|C_j)P(C_j)}

となる。ここで

\theta_k=\log\displaystyle{P(\textbf{x}|C_k)P(C_k)}

と置くと

\displaystyle{P(C_k|\textbf{x}_i)}=\frac{\exp(\theta_k)}{\displaystyle{\sum_{j=1}^k} \exp(\theta_j)}

であり、これは事後確率をソフトマックス関数の表現に変形したもの。

ちなみに、確率和$\sum_iP(C_k|\textbf{x}_i)$は $N$種の入力値によるクラス$C_k$に属する確率となる(規格化のため$N$で割ること)

$D=1$では単純なロジスティックシグモイド関数になり、このとき事後確率は対数オッズで表現できる。機械学習の文脈では出力がロジスティックシグモイド関数のとき、これをニューラルネットワークで線形近似しているらしい(だからクラス同士を線形分離できる)。
なんで線形近似できるの?という疑問については、どうやらロジスティックシグモイド関数の場合には証明がされているぽい(ムズ‐)。
https://qiita.com/mochimochidog/items/ca04bf3df7071041561a

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?