2026年2月2日月曜日

Xからの拾い物(メモ) MCMC

 

X
https://x.com/mathelirium/status/2018229046774039038

The most important tool in Probability and Statistics - Markov Chain Monte Carlo (MCMC) Method Fresh out of undergraduate Probability and Stats courses, it’s easy to feel invincible. You’ve tamed Gaussians, gammas, betas, all those neat closed-form toy distributions. Then research hits and you meet the harsher truth. Real posteriors and energy landscapes are jagged, asymmetric, multimodal, and too high-dimensional to integrate or sample from directly. You can’t compute the normalising constant. You can’t do the integrals by hand. And i.i.d. samples are basically science fiction. Markov Chain Monte Carlo is the hack we invented to survive that reality. Instead of drawing perfect samples, you send a carefully designed random walk wandering through the landscape, then use its long-run positions as your window into the target distribution. Here’s the problem. Standard trace plots and diagnostics can still cheerfully lie to you. High-dimensional geometry can make a chain that looks healthy while it’s effectively frozen. Multimodal targets, bad tuning, and hidden correlations can quietly wreck your posterior summaries. This series is about those blind spots. We’ll use visuals like this one to show how MCMC actually moves, where the guarantees get slippery, and how to think clearly about convergence and diagnostics in serious Bayesian, physics, and ML work. #BayesianInference #MCMC #MonteCarloMethods #ProbabilityLandscape #StatisticsEducation #ComputationalScience


MCMC

なにかってーとさ、

夜に真っ暗な山って想像できないじゃん。
谷は何処で、頂上は何処かって分からないじゃん。
なので1人、歩かせるんだよ。
(我家は山の中なのでそういう喩えになってしまうw)

大抵の人は分からないし怖いから、STOPしちゃう。
でも一歩進んだら、ちょっと気持ちが楽になる。

どきどきしながらだけど、何か変わった感じしない?ってこと。

一歩進めば何か変わらない?
止まってれば何も起こらない。

でも、徘徊者のように、うろうろさせればいいって話じゃないんだよね。
情報が蓄積されないし、判断する基準が更新されないし、意味もないから。

本質は「差分」を感じる事。
絶対値は分からないし、全体像も分からない。でも

「さっきよっか、マシだべ?」

自律で喩えると

行動はゴールじゃなくて
行動は観測


対してHMCってもあって
夜の山は怖いけど、勢いをつけてスケボーで降りてくる感じ。
なんだよ、地形ある程度知ってるんじゃん、みたいな。
先に微分が取れないと動けない。


MCMCは結局、

  • 目的分布 p(x)p(x)(=欲しい分布)

  • あるいはエネルギー E(x)E(x)p(x)exp(E(x))p(x)\propto \exp(-E(x))

を「直接サンプルできない」から、歩かせて偏りを作る技術。

だから、アソシアトロン系(連想記憶・アトラクタ・スプリアス・多峰性)みたいに

  • 谷(記憶)

  • 山(障壁)

  • 混合(スプリアス)

がある世界は、MCMCのホームグラウンド。

でも、MCMCは平気で嘘つく(=見かけ上それっぽく動く)ので、複数チェーン(初期値を離す)、R^(1.01未満でも過信しない)、ESS(有効サンプルサイズ)、rank plot / trace / autocorr(見た目の癖が分かる)、多峰性が疑わしいなら:温度付き(tempering) を最初から検討


直感的には:

  • 高温:山を越えられる(探索)

  • 低温:谷に落ちて精密化(推定)

  • 交換:探索結果を精密化へ渡す




--------------別メモ----------------
スプリアスの出現率を“統計”に使えるか・・

スプリアスの出現率を“統計”にする
状態 xx(想起パターン)
エネルギー E(x)E(x)(ダイナミクスに対応させる)
温度を振ってサンプル
どの盆地が何% を出す
 15%問題や混合記憶の「体感」を数値化できる
これだな。


“Cueの強さ” を推定する(逆問題)
観測:想起結果(成功/失敗、どの記憶に落ちたか)
未知:Cueノイズ、閾値、競合パラメータ
   ↓
MCMCでパラメータの事後分布
 「この条件だと成功率はこのくらい」みたいな予測がちゃんと出るかもしれない


学習則の比較を “モデル選択” にする
学習則A/Bで、観測データに対する尤度(または近似尤度)を作って
→ ベイズ的に「どっちが筋が良いか」を比較


Python→JAXと相性いいかな・・・



0 件のコメント:

コメントを投稿

アソシアトロン論文 the Associatron paper by Nakano (1972)

  中野馨先生の論文 Kaoru Nakano(中野馨) “Learning Process in a Model of Associative Memory” Nakano, K. (1971). Learning Process in a Model of Associati...