使用近似贝叶斯准则的LoadError

时间:2018-08-20 19:19:28

标签: optimization julia differential-equations

我遇到一个使我感到困惑的错误。

using DifferentialEquations
using RecursiveArrayTools # for VectorOfArray
using DiffEqBayes
f2 = @ode_def_nohes LotkaVolterraTest begin
  dx = x*(1 - x - A*y)
  dy = rho*y*(1 - B*x - y)
end A B rho

u0 = [1.0;1.0]
tspan = (0.0,10.0)
p = [0.2,0.5,0.3]
prob = ODEProblem(f2,u0,tspan,p)
sol = solve(prob,Tsit5())
t = collect(linspace(0,10,200))
randomized = VectorOfArray([(sol(t[i]) + .01randn(2)) for i in 1:length(t)])
data = convert(Array,randomized)

priors = [Uniform(0.0, 2.0), Uniform(0.0, 2.0), Uniform(0.0, 2.0)]
bayesian_result_abc = abc_inference(prob, Tsit5(), t, data,
priors;num_samples=500)

返回错误

ERROR: LoadError: DimensionMismatch("first array has length 400 which does not match the length of the second, 398.")
while loading..., in expression starting on line 20.

我无法找到大小为400或398的任何数组。 感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

看看https://github.com/JuliaDiffEq/DiffEqBayes.jl/issues/52,这是由于传递t时出错。此问题已在master上修复,因此您可以使用它或等待一段时间,我们很快将发布带有1.0升级的新版本,该版本也已修复。

谢谢!