Skip to content

Commit

Permalink
clean up docs, add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
francescoalemanno committed Sep 7, 2020
1 parent 2e066bb commit 9b71195
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 31 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ julia> smc(prior,cost)
(P = Particles{Float64,79}[2.0 ± 0.0062, 0.0401 ± 0.00081], W = 0.0127, ϵ = 0.011113205245491245)
```

to know how to tune the configuration defaults of `smc`, consult the docs :)
to know how to tune the configuration defaults of `smc`, consult the docs :)
for more example look at the `examples` folder.
3 changes: 0 additions & 3 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
KissABC = "9c9dad79-530a-4643-a18b-2704674d4108"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
16 changes: 1 addition & 15 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
using KissABC
using Documenter
#using Literate
#using Plots
#ENV["GKSwstype"] = "100"
#@show joinpath(@__DIR__, "src")
#=Literate.markdown(
joinpath(@__DIR__, "literate", "example_1.jl"),
joinpath(@__DIR__, "src"),
documenter = true,
)=#
#=Literate.markdown(
joinpath(@__DIR__, "literate", "index.jl"),
joinpath(@__DIR__, "src"),
documenter = true,
)
@info "Literate finished."=#

makedocs(;
modules = [KissABC],
authors = "Francesco Alemanno <francescoalemanno710@gmail.com> and contributors",
Expand Down
4 changes: 2 additions & 2 deletions docs/literate/index.jl → examples/example_n1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ res = sample(

# You can also use Sequential Monte Carlo (SMC) to infer posterior parameters:

#ressmc = smc(prior, cost, nparticles=500, epstol=0.01)
ressmc = smc(prior, cost, nparticles=500, epstol=0.01)

#@show ressmc
@show ressmc

# the parameters we chose are: a tolerance on distances equal to `0.1`, a number of samples equal to `2000`, the simulated posterior results are in `res`.
# We can now extract the inference results:
Expand Down
10 changes: 0 additions & 10 deletions docs/literate/example_1.jl → examples/example_n2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ end
parameters = (1.0, 0.0, 0.2, 2.0, 0.4)
data = model(parameters, 200)

# let's look at the data

using Plots
histogram(data,bins=100)
savefig("ex1_hist1.svg");
nothing; # hide

# ![ex1_hist1](ex1_hist1.svg)

# we can now try to infer all parameters using `KissABC`, first of all we need to define a reasonable prior for our model

prior = Factored(
Expand Down Expand Up @@ -67,4 +58,3 @@ approx_density = ApproxPosterior(prior, D, 0.032)
# In this case, it is best to apply SMC, as it leads to tighter CI's and lower computational costs
@time res = smc(prior, D, verbose=false, nparticles=100, alpha=0.95)
@show res.P

0 comments on commit 9b71195

Please sign in to comment.