我想使用pymc3来估计霍奇金·赫x黎神经元模型中的未知参数和状态。我在pymc中的代码基于http://healthyalgorithms.com/2010/10/19/mcmc-in-python-how-to-stick-a-statistical-model-on-a-system-dynamics-model- in-pymc /并执行得很好。
#parameter priors
@deterministic
def HH(priors in here)
#model equations
#return numpy arrays that somehow contain the probability distributions as elements
return V,n,m,h
#Make V deterministic in one line. Seems to be the magic that makes this work.
V = Lambda('V', lambda HH=HH: HH[0])
#set up the likelihood
A = Normal('A',mu=V,tau=2.0,value=voltage_data,observed = True)
#run the sampling...
Run Code Online (Sandbox Code Playgroud)
在pymc3中,我无法使用Lambda技巧。这是我的尝试之一:
import numpy as np
import theano.tensor as tt
from pymc3 import Model, Normal, Uniform, Deterministic, sample, NUTS, Metropolis, find_MAP …Run Code Online (Sandbox Code Playgroud)