我在他的特德谈话Here中遇到了亚历克斯威斯纳 - 格雷和他的智能行为理论。 我试图阅读与他的演讲相关的学术论文Here,但我对数学和物理学的理解不足以真正了解正在发生的事情,更重要的是,我如何能够重现这个等式在python中。
有一些独特的熵最大化模型我发现它是在python中实现的,但我不知道如何设置它们以及它们是否与Wissner-gross方程相同。
Scipy:MaxEntropy
假设这些方程是Wissner方程的不同形式,并使用上面的库或其他库,我该如何设置熵最大化算法。
特别是,
答案 0 :(得分:5)
这个问题非常笼统,不幸的是我不认为这个答案会给你一个你可能希望的解决方案。
首先,您认为“这些方程式是Wissner方程的不同形式”的假设是不好的。
浏览过这篇论文后,似乎他们称之为因果熵力( F )的模型与最大熵模型共享一些成分(毫不奇怪),你已经找到了一些库。但是,要了解这些库如何用于因果熵强制的实现,您将不得不查看该论文并找出不同的表达式如何匹配/共享组件。我怀疑这里的任何人都会为你做这件事。 Wikipedia article about maximum entropy可以帮助您找到关系。
为了开始动画和动作,我建议你找一些精灵动画的介绍,for example this one。这将帮助您了解如何使用代码在空间中移动对象。
修改强>
论文的supplemental material绝对值得一看,甚至包含一些伪代码。此外,论文中的参考文献[12]内容如下:
我们的通用因果熵力模拟软件将在http://www.causalentropy.org
提供探索
答案 1 :(得分:0)
我尝试以某种简单的方式应用该演讲中的想法。
我想象中的系统有一个变量,增加了均匀的噪音和正反馈。想象在重力场的棍子上平衡的棍子的角度。 我想象系统在一个时间刻度中的演变被描述为
kicks = [0, -5*noise, 5*noise]
如果我运行此模拟,theta会快速转到PI或-PI并在那里波动。
现在我介绍一下踢球的概念(这里我们要么什么都不做,要么左右推动系统,噪音要难5倍):
while True:
best_kick = None
for kick in kicks:
median_var = simulate_median_var(theta + kick)
if (best_kick is None) or (median_var > best_median_var):
best_median_var = median_var
best_kick = kick
print "theta=%f\tbest_kick=*\t\tbest_median_var=%f" % (theta, best_median_var)
theta = theta + best_kick
theta = simulate1(theta)
最后,我们来到主循环。在每次迭代中,下面的装置考虑了给系统提供一个启动的可能性,并计算了一个与未来可能的多样性相关的度量(希望与原始问题中的熵相关):
#
# estimate variation of possible future
# assume the variation is higher is standard deviation is higher (is it good one?)
#
def simulate_var(theta, ticks):
thetas = simulate(theta, ticks)
(theta_hist, _) = numpy.histogram(thetas)
#print "# %s" % theta_hist
return numpy.std(theta_hist)
# calculate median of the variaion for so many rounds
def simulate_median_var(theta):
vars = []
for _ in range(rounds):
var = simulate_var(theta, ticks)
vars.append(var)
return numpy.median(vars)
以下是指标的实际实施:
theta=0.000000 best_kick=0.000000 best_median_var=16.443844 # [(-0.005, 12.13260071048248), (0, 16.443843832875572), (0.005, 12.13260071048248)]
theta=0.000328 best_kick=0.000000 best_median_var=16.437761 # [(-0.005, 12.320714265009151), (0, 16.437761404765553), (0.005, 12.091319200153471)]
theta=0.001096 best_kick=0.000000 best_median_var=15.811388 # [(-0.005, 12.735776379946374), (0, 15.811388300841896), (0.005, 11.798304963002099)]
theta=0.001218 best_kick=0.000000 best_median_var=15.792403 # [(-0.005, 12.743625857659193), (0, 15.792403236999744), (0.005, 11.798304963002099)]
theta=0.000433 best_kick=0.000000 best_median_var=16.437761 # [(-0.005, 12.320714265009151), (0, 16.437761404765553), (0.005, 11.958260743101398)]
theta=0.000931 best_kick=0.000000 best_median_var=16.112107 # [(-0.005, 12.625371281669304), (0, 16.112107248898266), (0.005, 11.798304963002099)]
theta=0.001551 best_kick=0.000000 best_median_var=14.913082 # [(-0.005, 13.046072205840346), (0, 14.913081505845799), (0.005, 11.661903789690601)]
theta=0.001249 best_kick=0.000000 best_median_var=15.491933 # [(-0.005, 12.759310326189265), (0, 15.491933384829668), (0.005, 11.798304963002099)]
theta=0.002275 best_kick=0.000000 best_median_var=14.021412 # [(-0.005, 13.512956745287095), (0, 14.021412197064887), (0.005, 11.523888232710346)]
theta=0.002349 best_kick=0.000000 best_median_var=14.035669 # [(-0.005, 13.527749258468683), (0, 14.035668847618199), (0.005, 11.523888232710346)]
theta=0.002224 best_kick=0.000000 best_median_var=14.085453 # [(-0.005, 13.535139452550904), (0, 14.085453489327207), (0.005, 11.523888232710346)]
theta=0.002126 best_kick=0.000000 best_median_var=14.300346 # [(-0.005, 13.512956745287095), (0, 14.300345799157828), (0.005, 11.523888232710346)]
theta=0.003034 best_kick=-0.005000 best_median_var=14.615061 # [(-0.005, 14.615060725156088), (0, 13.274034804836093), (0.005, 11.41052146047673)]
theta=-0.003091 best_kick=0.005000 best_median_var=14.587666 # [(-0.005, 11.41052146047673), (0, 13.274034804836093), (0.005, 14.587666023048376)]
theta=0.001966 best_kick=0.000000 best_median_var=14.345731 # [(-0.005, 13.274034804836093), (0, 14.345731072343439), (0.005, 11.636150566231086)]
theta=0.002721 best_kick=-0.005000 best_median_var=14.021412 # [(-0.005, 14.021412197064887), (0, 13.512956745287095), (0.005, 11.523888232710346)]
theta=-0.002635 best_kick=0.005000 best_median_var=14.021412 # [(-0.005, 11.523888232710346), (0, 13.535139452550904), (0.005, 14.021412197064887)]
theta=0.002066 best_kick=0.000000 best_median_var=14.310835 # [(-0.005, 13.29661611087573), (0, 14.310835055998654), (0.005, 11.636150566231086)]
theta=0.001485 best_kick=0.000000 best_median_var=15.198684 # [(-0.005, 12.969194269498781), (0, 15.198684153570664), (0.005, 11.781341180018513)]
theta=0.001414 best_kick=0.000000 best_median_var=15.201973 # [(-0.005, 12.984606270503546), (0, 15.201973200284616), (0.005, 11.781341180018513)]
theta=0.000542 best_kick=0.000000 best_median_var=16.431676 # [(-0.005, 12.328828005937952), (0, 16.431675598153642), (0.005, 11.958260743101398)]
theta=0.000726 best_kick=0.000000 best_median_var=16.443844 # [(-0.005, 12.521980673998822), (0, 16.443843832875572), (0.005, 11.958260743101398)]
theta=0.000633 best_kick=0.000000 best_median_var=16.437761 # [(-0.005, 12.433824833895642), (0, 16.437761404765553), (0.005, 11.958260743101398)]
theta=-0.000171 best_kick=0.000000 best_median_var=16.437761 # [(-0.005, 12.116104984688768), (0, 16.437761404765553), (0.005, 12.255610959882823)]
theta=-0.000934 best_kick=0.000000 best_median_var=15.824032 # [(-0.005, 11.798304963002099), (0, 15.824032355881986), (0.005, 12.545915670049755)]
theta=-0.000398 best_kick=0.000000 best_median_var=16.440803 # [(-0.005, 11.958260743101398), (0, 16.440802618820562), (0.005, 12.320714265009151)]
theta=-0.001464 best_kick=0.000000 best_median_var=14.913082 # [(-0.005, 11.661903789690601), (0, 14.913081505845799), (0.005, 12.969194269498781)]
theta=-0.002141 best_kick=0.000000 best_median_var=14.310835 # [(-0.005, 11.532562594670797), (0, 14.310835055998654), (0.005, 13.512956745287095)]
theta=-0.002893 best_kick=0.005000 best_median_var=14.314328 # [(-0.005, 11.41052146047673), (0, 13.512956745287095), (0.005, 14.314328059637504)]
theta=0.003015 best_kick=-0.005000 best_median_var=14.314328 # [(-0.005, 14.314328059637504), (0, 13.274034804836093), (0.005, 11.41052146047673)]
theta=-0.002201 best_kick=0.000000 best_median_var=14.042792 # [(-0.005, 11.532562594670797), (0, 14.042791745233567), (0.005, 13.45362404707371)]
theta=-0.002234 best_kick=0.000000 best_median_var=14.042792 # [(-0.005, 11.523888232710346), (0, 14.042791745233567), (0.005, 13.512956745287095)]
theta=-0.001903 best_kick=0.000000 best_median_var=14.473666 # [(-0.005, 11.653325705565772), (0, 14.473665878659745), (0.005, 13.274034804836093)]
theta=-0.002782 best_kick=0.005000 best_median_var=14.085453 # [(-0.005, 11.41052146047673), (0, 13.520355024924458), (0.005, 14.085453489327207)]
theta=0.003083 best_kick=-0.005000 best_median_var=14.587666 # [(-0.005, 14.587666023048376), (0, 13.274034804836093), (0.005, 11.41052146047673)]
theta=-0.001439 best_kick=0.000000 best_median_var=15.491933 # [(-0.005, 11.661903789690601), (0, 15.491933384829668), (0.005, 12.961481396815721)]
首先,它计算可能的系统状态的概率分布。然后我们使用numpy.hist()在10个箱子中对theta的整个历史演变进行排序。然后我们计算所有箱子的标准偏差。它不一定是最好的衡量标准,但它似乎可以作为一个大概估计。
以下是输出(带有一些额外的调试信息)的样子:
noise = 0.001 # noise amplitude
kicks = [-5*noise, 0, 5*noise] # what kicks to try
ticks = 100 # now many time ticks to simulate
rounds = 1000 # now many rounds to simulate
dt = 0.1 # simulation rate koefficient, something like dt
上述模拟是通过以下方式完成的:
vFile_
我意识到原始论文中并没有完全遵循数学,但(相当不准确)使用了它的一般概念。