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?

Bayes 推論の基礎と「影が上にできる」凹凸推定の例

Last updated at Posted at 2025-07-29

自由エネルギー原理を学ぶ過程で、「感覚データから世界モデルを更新する仕組み」としてBayes推論が核心にあるため、備忘録として以下に整理してみました。

1. Bayes 推論の枠組み

隠れ状態(原因)を x、観測データ(感覚信号)を y とすると、次の 4 つの確率を定義できます。

1.1 事前確率 (Prior)

$$
p(x)
$$

  • 観測前に「状態 x である」と予め知っている確率

1.2 条件付き確率 (Likelihood / 尤度)

$$
p(y \mid x)
$$

  • 隠れ状態が x のときに「感覚信号 y が観測される」確率

1.3 周辺尤度 (Evidence)

$$
p(y)
= \sum_{x} p(y, x)
= \sum_{x} p(y \mid x),p(x)
$$

  • 観測データ y が得られる全体の確率

1.4 Bayes の定理 (事後確率 / Posterior)

$$
p(x \mid y)
= \frac{p(y \mid x),p(x)}{p(y)}
$$

  • 観測後に「状態 x である」と更新された確率

2. 同時確率との関係

同時確率は尤度と事前確率の積で表されます。

$$
p(y, x) = p(y \mid x),p(x)
$$

これを各 x について計算すると、周辺尤度や事後確率を得ることができます。


3. 「影が上にできる」例:数値を当てはめてみる

隠れ状態 $x$ 事前確率 $p(x)$ 尤度 $p(y=\text{影}\mid x)$
凹面 0.45 0.90
凸面 0.55 0.10
  1. 同時確率
    $$
    p(\text{影}, \text{凹}) = 0.9 \times 0.45 = 0.405,
    \quad
    p(\text{影}, \text{凸}) = 0.1 \times 0.55 = 0.055
    $$

  2. 周辺尤度
    $$
    p(\text{影}) = 0.405 + 0.055 = 0.46
    $$

  3. 事後確率
    $$
    p(\text{凹} \mid \text{影})
    = \frac{0.405}{0.46} \approx 0.88,
    \quad
    p(\text{凸} \mid \text{影})
    = \frac{0.055}{0.46} \approx 0.12
    $$
    → 影が上にできた情報の下では、「凹面」である確率が約 88 % になります。


4. 最大事後確率推定 (MAP 推定)

事後確率が最大となる状態 x を推定値とする方法です:

\hat{x}_{\mathrm{MAP}}
= \arg\max_{x}\;p(x \mid y)
= \arg\max_{x}\;\bigl[p(y \mid x)\,p(x)\bigr]
  • 分母 $p(y)$ はすべての$ x $で共通定数なので、比較の際には無視できます。
  • 本例では:
    • 凹面:$0.9 \times 0.45 = 0.405$
    • 凸面:$0.1 \times 0.55 = 0.055$

$$
\therefore \hat{x}_{\mathrm{MAP}} = \text{凹面}
$$


5. まとめ

  • 事前確率 $ p(x) $ と 尤度 $ p(y\mid x) $ から同時確率 $ p(y,x) $を計算
  • 同時確率を足し合わせて 周辺尤度 $ p(y) $ を得る
  • Bayes の定理で 事後確率 $ p(x\mid y) $ を得る
  • MAP 推定 では「尤度×事前確率」の大きい方を選ぶだけ

ベイズ推論は「観測前の知識 (Prior) + 観測からの情報 (Likelihood)」を統合し、「観測後の確からしさ (Posterior)」を計算する強力な枠組みです。

6. 参考文献

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?