Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
jClugstor committed Jul 26, 2024
1 parent c7fbf1b commit b299db5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions test/datafit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ using ModelingToolkit: t_nounits as t, D_nounits as D
@parameters α β γ δ
@variables x(t) y(t)

eqs = [D(x) ~ α*x - β*x*y,
D(y) ~ -γ*y + δ*x*y]
eqs = [D(x) ~ α * x - β * x * y,
D(y) ~ -γ * y + δ * x * y]

@mtkbuild sys = ODESystem(eqs, t)

u0 = [x => 1.0,
y => 1.0]

p ==> 2/3,
β => 4/3,
p ==> 2 / 3,
β => 4 / 3,
γ => 1,
δ => 1]

Expand Down Expand Up @@ -51,7 +51,6 @@ scores = model_forecast_score([prob, prob2, prob3], tsave, data)
@test scores[2] < 2e-3
@test scores[3] > 2


psub_ini = [
α => [0.5, 0.9],
β => [0.9, 1.5],
Expand All @@ -73,7 +72,7 @@ pvals = getfield.(p, :second)

eqs_obs = [D(x) ~ α * x - β * x * y,
D(y) ~ -γ * y + δ * x * y,
x_2 ~ 2*x]
x_2 ~ 2 * x]

@mtkbuild sys_obs = ODESystem(eqs_obs, t)

Expand All @@ -93,8 +92,8 @@ tsave = collect(1.0:1.0:10.0)
sol_data = solve(prob, saveat = tsave)
data = [x => sol_data[x], y => sol_data[y]]


p_prior ==> Normal(2/3, 0.1), β => Normal(4/3,0.1), γ => Normal(1, 0.1), δ => Normal(1, 0.1)]
p_prior ==> Normal(2 / 3, 0.1), β => Normal(4 / 3, 0.1),
γ => Normal(1, 0.1), δ => Normal(1, 0.1)]
p_posterior = @time bayesian_datafit(prob, p_prior, tsave, data, niter = 3000)
@test var.(getfield.(p_prior, :second)) >= var.(getfield.(p_posterior, :second))

Expand Down
2 changes: 1 addition & 1 deletion test/ensemble.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using EasyModelAnalysis, LinearAlgebra, Test
using ModelingToolkit: t_nounits as t, D_nounits as ∂
using ModelingToolkit: t_nounits as t, D_nounits as ∂

@parameters β=0.05 c=10.0 γ=0.25
@variables S(t)=990.0 I(t)=10.0 R(t)=0.0
Expand Down

0 comments on commit b299db5

Please sign in to comment.