diff --git a/docs/literate.jl b/docs/literate.jl index 49bd970..879ec10 100644 --- a/docs/literate.jl +++ b/docs/literate.jl @@ -15,4 +15,4 @@ using Literate: Literate # Convert to markdown and notebook const SCRIPTJL = joinpath(EXAMPLEPATH, "script.jl") -Literate.markdown(SCRIPTJL, OUTDIR; name=EXAMPLE, documenter=false, execute=true) +Literate.markdown(SCRIPTJL, OUTDIR; name=EXAMPLE, execute=true) diff --git a/docs/make.jl b/docs/make.jl index 76fadad..2c0aa19 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -61,7 +61,7 @@ makedocs(; )..., ], ], - strict=true, + #strict=true, checkdocs=:exports, doctestfilters=[ # Older versions will show "0 element Array" instead of "Type[]". diff --git a/examples/gaussian-ssm/script.jl b/examples/gaussian-ssm/script.jl index cb4cc15..915a581 100644 --- a/examples/gaussian-ssm/script.jl +++ b/examples/gaussian-ssm/script.jl @@ -83,12 +83,10 @@ for t in 1:Tₘ end # Here are the latent and obseravation timeseries -plot(x; label="x") -xlabel!("t") +plot(x; label="x", xlabel="t") -# -plot(y; label="y") -xlabel!("x") +# +plot(y; label="y", xlabel="t") # `AdvancedPS` subscribes to the `AbstractMCMC` API. To sample we just need to define a Particle Gibbs kernel # and a model interface. @@ -103,11 +101,9 @@ mean_trajectory = mean(particles; dims=2); #md nothing #hide # This toy model is small enough to inspect all the generated traces: -scatter(particles; label=false, opacity=0.01, color=:black) +scatter(particles; label=false, opacity=0.01, color=:black, xlabel="t", ylabel="state") plot!(x; color=:darkorange, label="Original Trajectory") plot!(mean_trajectory; color=:dodgerblue, label="Mean trajectory", opacity=0.9) -xlabel!("t") -ylabel!("State") # We used a particle gibbs kernel with the ancestor updating step which should help with the particle # degeneracy problem and improve the mixing. @@ -116,7 +112,5 @@ update_rate = sum(abs.(diff(particles; dims=2)) .> 0; dims=2) / Nₛ #md nothing #hide # and compare it to the theoretical value of $1 - 1/Nₚ$. -plot(update_rate; label=false, ylim=[0, 1], legend=:bottomleft) +plot(update_rate; label=false, ylim=[0, 1], legend=:bottomleft, xlabel="Iteration", ylabel="Update rate") hline!([1 - 1 / Nₚ]; label="N: $(Nₚ)") -xlabel!("Iteration") -ylabel!("Update rate") diff --git a/examples/particle-gibbs/script.jl b/examples/particle-gibbs/script.jl index a6b372c..b4683e4 100644 --- a/examples/particle-gibbs/script.jl +++ b/examples/particle-gibbs/script.jl @@ -67,12 +67,11 @@ for t in 1:Tₘ end # Here are the latent and observation series: -plot(x; label="x") -xlabel!("t") +plot(x; label="x", xlabel="t") + +# +plot(y; label="y", xlabel="t") -# -plot(y; label="y") -xlabel!("x") # Each model takes an `AbstractRNG` as input and generates the logpdf of the current transition: function (model::NonLinearTimeSeries)(rng::Random.AbstractRNG) @@ -125,12 +124,9 @@ mean_trajectory = mean(particles; dims=2) # We can now plot all the generated traces. # Beyond the last few timesteps all the trajectories collapse into one. Using the ancestor updating step can help # with the degeneracy problem. -plot() -scatter(particles; label=false, opacity=0.01, color=:black) +scatter(particles; label=false, opacity=0.01, color=:black, xlabel="t", ylabel="state") plot!(x; color=:darkorange, label="Original Trajectory") plot!(mean_trajectory; color=:dodgerblue, label="Mean trajectory", opacity=0.9) -xlabel!("t") -ylabel!("State") # We can also check the mixing as defined in the Gaussian State Space model example. As seen on the # scatter plot above, we are mostly left with a single trajectory before timestep 150. The orange @@ -138,7 +134,5 @@ ylabel!("State") update_rate = sum(abs.(diff(particles; dims=2)) .> 0; dims=2) / Nₛ #md nothing #hide -plot(update_rate; label=false, ylim=[0, 1], legend=:bottomleft) +plot(update_rate; label=false, ylim=[0, 1], legend=:bottomleft, xlabel="Iteration", ylabel="Update rate") hline!([1 - 1 / Nₚ]; label="N: $(Nₚ)") -xlabel!("Iteration") -ylabel!("Update rate")