Skip to content
Snippets Groups Projects
Commit 5d8c423e authored by Bentriou Mahmoud's avatar Bentriou Mahmoud
Browse files

fix in plots of third notebook

parent ed3f850c
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# ABC-SMC with ContinuousTimeModel # ABC-SMC with ContinuousTimeModel
The package allows the run of ABC-SMC algorithm with models defined by the package. The package allows the run of ABC-SMC algorithm with models defined by the package.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` julia ``` julia
using MarkovProcesses using MarkovProcesses
using Distributions using Distributions
load_model("SIR") load_model("SIR")
set_time_bound!(SIR, 100.0) set_time_bound!(SIR, 100.0)
parametric_SIR = ParametricModel(SIR, (:ki, Uniform(0.001, 0.0015))) parametric_SIR = ParametricModel(SIR, (:ki, Uniform(0.001, 0.0015)))
vec_observations = [simulate(SIR)] vec_observations = [simulate(SIR)]
function dist_obs(vec_sim::Vector{Trajectory}, vec_observations::Vector{Trajectory}) function dist_obs(vec_sim::Vector{Trajectory}, vec_observations::Vector{Trajectory})
return dist_lp(vec_sim[1], vec_observations[1]; p=2) return dist_lp(vec_sim[1], vec_observations[1]; p=2)
end end
epsilon = 0.5 * dist_obs([simulate(SIR)], vec_observations) epsilon = 0.5 * dist_obs([simulate(SIR)], vec_observations)
@show epsilon @show epsilon
res_abc = abc_smc(parametric_SIR, vec_observations, dist_obs, nbr_particles = 100, tolerance = epsilon) res_abc = abc_smc(parametric_SIR, vec_observations, dist_obs, nbr_particles = 100, tolerance = epsilon)
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` julia ``` julia
using Plots using Plots
histogram(res_abc.mat_p_end, weights = res_abc.weights_end) histogram(vec(res_abc.mat_p_end), weights = res_abc.weights)
```
%% Cell type:code id: tags:
``` julia
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment