Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some updates #154

Merged
merged 2 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update Truncated to truncated
  • Loading branch information
Vaibhavdixit02 committed Apr 22, 2020
commit fe24c28f4272c36fca42ed1843aa4248b068c901
4 changes: 2 additions & 2 deletions test/abc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ 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,1),0,2),Truncated(Normal(1.0,1),0,1.5),
Truncated(Normal(3.0,1),0,4),Truncated(Normal(1.0,1),0,2)]
priors = [truncated(Normal(1.5,1),0,2),truncated(Normal(1.0,1),0,1.5),
truncated(Normal(3.0,1),0,4),truncated(Normal(1.0,1),0,2)]

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

Expand Down
10 changes: 5 additions & 5 deletions test/dynamicHMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ likelihood = function (sol)
end
return l
end
@test_broken bayesian_result = dynamichmc_inference(prob1, Tsit5(), likelihood, [Truncated(Normal(1.5, 1), 0, 2)], as((a = asℝ₊,)))
@test_broken bayesian_result = dynamichmc_inference(prob1, Tsit5(), likelihood, [truncated(Normal(1.5, 1), 0, 2)], as((a = asℝ₊,)))
@test_broken mean(bayesian_result[1][1]) ≈ 1.5 atol=1e-1


Expand All @@ -79,10 +79,10 @@ 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 = (a = Truncated(Normal(1.5,0.01), 0, 2),
b = Truncated(Normal(1.0,0.01), 0, 1.5),
c = Truncated(Normal(3.0,0.01), 0, 4),
d = Truncated(Normal(1.0, 0.01), 0, 2))
priors = (a = truncated(Normal(1.5,0.01), 0, 2),
b = truncated(Normal(1.0,0.01), 0, 1.5),
c = truncated(Normal(3.0,0.01), 0, 4),
d = truncated(Normal(1.0, 0.01), 0, 2))
mcmc_kwargs = (initialization = (q = zeros(4 + 2),), reporter = reporter)
bayesian_result = dynamichmc_inference(prob1, Tsit5(), t, data, priors,
as(Vector, asℝ₊, 4),mcmc_kwargs = mcmc_kwargs)
Expand Down
8 changes: 4 additions & 4 deletions test/stan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.1),0,2)]
priors = [truncated(Normal(1.5,0.1),0,2)]

bayesian_result = stan_inference(prob1,t,data,priors;num_samples=300,
num_warmup=500,likelihood=Normal)
Expand All @@ -35,7 +35,7 @@ sdf = CmdStan.read_summary(bayesian_result.model)
sol = solve(prob1,Tsit5(),save_idxs=[1])
randomized = VectorOfArray([(sol(t[i]) + .01 * randn(1)) for i in 1:length(t)])
data = convert(Array,randomized)
priors = [Truncated(Normal(1.5,0.1),0,2)]
priors = [truncated(Normal(1.5,0.1),0,2)]
bayesian_result = stan_inference(prob1,t,data,priors;num_samples=300,
num_warmup=500,likelihood=Normal,save_idxs=[1])

Expand Down Expand Up @@ -64,8 +64,8 @@ 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)]
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 = stan_inference(prob1,t,data,priors;num_samples=100,num_warmup=500,vars =(DiffEqBayes.StanODEData(),InverseGamma(4,1)))
sdf = CmdStan.read_summary(bayesian_result.model)
Expand Down