R/Pythonではじめる計算論的精神医学

『R/Pythonではじめる計算論的精神医学』、書店の医学書コーナーでこのタイトルを見て驚いて買いました。

幻覚など精神疾患をシミュレーションで再現しているとなると、これは意識を再現しているということ。

疾患の治療に役立つという一方、ゴッホやムンクのように精神疾患を抱えることで偉大な芸術が生み出され、その原理もまた、明らかになろうとしている。

こんな大変なことが分かってきているのに、なぜ今まで気が付かなかったのか!帰って大急ぎで読んだら期待した内容と若干違って、眼球運動とかのニューラルネットワークの話でした。

ただ、最後に数ページだけ触れていた自由エネルギー原理が気になる。自由意志に関わる話ですね。

で、先ほどChatGPTに詳しく聞いてみました。そこからが、ちょっとヤバいです。

自由エネルギー原理と能動的推論エージェントを組み合わせたら意識になるらしい。試しにPythonで幻覚のシミュレーションを書かせたら・・・

============================================

import numpy as np
import matplotlib.pyplot as plt
class DelusionalHallucinatoryAgent:
   def __init__(self, hallucination_mode=False, delusion_mode=False):
       self.belief = 0.0  # 自分の位置や状態の信念
       self.precision = 0.1 if hallucination_mode else 1.0  # 感覚信号の信頼度
       self.learning_rate = 0.05 if delusion_mode else 0.2  # 信念更新のしやすさ
       self.goal = 5
   def update_belief(self, observation):
       prediction_error = observation - self.belief
       self.belief += self.learning_rate * self.precision * prediction_error
   def select_action(self):
       if self.belief < self.goal:
           return +1
       else:
           return -1
class SimpleWorld:
   def __init__(self, noise=0.5):
       self.position = 0
       self.noise = noise
   def observe(self):
       return self.position + np.random.normal(0, self.noise)
   def step(self, action):
       self.position += action
       return self.observe()
def simulate(agent, world, steps=30):
   beliefs, positions = [], []
   for _ in range(steps):
       obs = world.observe()
       agent.update_belief(obs)
       action = agent.select_action()
       world.step(action)
       beliefs.append(agent.belief)
       positions.append(world.position)
   return beliefs, positions
def plot_belief_vs_reality(beliefs, positions, title=""):
   plt.plot(beliefs, label="Belief (内的予測)")
   plt.plot(positions, label="True Position (現実)")
   plt.xlabel("Step")
   plt.ylabel("Position")
   plt.title(title)
   plt.legend()
   plt.grid(True)
   plt.show()
# ノーマル
normal_agent = DelusionalHallucinatoryAgent()
normal_world = SimpleWorld()
b1, p1 = simulate(normal_agent, normal_world)
plot_belief_vs_reality(b1, p1, "  正常なエージェント")
# 幻覚的(観測への信頼度が極端に低い = 精度が低い)
hallucinating_agent = DelusionalHallucinatoryAgent(hallucination_mode=True)
hallucinating_world = SimpleWorld()
b2, p2 = simulate(hallucinating_agent, hallucinating_world)
plot_belief_vs_reality(b2, p2, "  幻覚的エージェント(観測を無視)")
# 妄想的(信念更新が極端に鈍い)
delusional_agent = DelusionalHallucinatoryAgent(delusion_mode=True)
delusional_world = SimpleWorld()
b3, p3 = simulate(delusional_agent, delusional_world)
plot_belief_vs_reality(b3, p3, "  妄想的エージェント(信念を修正しない)")

============================================

これが意識の正体なのか・・・。もしかして、私は幻覚を見ているのでしょうか?

とりあえず昼ごはんを食べて落ち着こうと思いますが、最近、西田辺の「石窯パンの店『ゴッホ』」が美味しくて、気に入ってます。

Contact us

BACK TO TOP