Skip to content

Commit

Permalink
Remove version bound of Turing from REQUIRE to use latest
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaibhavdixit02 committed Feb 22, 2019
1 parent 61da1ea commit b7dc416
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DiffEqBase 5.0.0
#Mamba
Stan
Distributions
Turing 0.5.0
Turing
MacroTools
Optim
RecursiveArrayTools
Expand Down
8 changes: 4 additions & 4 deletions test/turing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ bayesian_result = turing_inference(prob1,Tsit5(),t,data,priors;num_samples=500)

@show mean(bayesian_result[:_theta][50:end])

@test mean(bayesian_result[:_theta1][50:end])[1] 1.5 atol=0.1
@test mean(bayesian_result[:_theta][50:end])[1] 1.5 atol=0.1

println("Four parameter case")
f1 = @ode_def begin
f2 = @ode_def begin
dx = a*x - b*x*y
dy = -c*y + d*x*y
end a b c d
u0 = [1.0,1.0]
tspan = (0.0,10.0)
p = [1.5,1.0,3.0,1.0]
prob1 = ODEProblem(f1,u0,tspan,p)
prob2 = ODEProblem(f2,u0,tspan,p)
sol = solve(prob1,Tsit5())
t = collect(range(1,stop=10,length=10))
randomized = VectorOfArray([(sol(t[i]) + .01randn(2)) for i in 1:length(t)])
data = convert(Array,randomized)
priors = [Truncated(Normal(1.5,0.01),0,2),Truncated(Normal(1.0,0.01),0,1.5),
Truncated(Normal(3.0,0.01),0,4),Truncated(Normal(1.0,0.01),0,2)]

bayesian_result = turing_inference(prob1,Tsit5(),t,data,priors;num_samples=500)
bayesian_result = turing_inference(prob2,Tsit5(),t,data,priors;num_samples=500)

@show mean(bayesian_result[:_theta][50:end])

Expand Down

0 comments on commit b7dc416

Please sign in to comment.