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

Chapter 5 - corrections #165

Open
entropidelic opened this issue Oct 20, 2022 · 0 comments
Open

Chapter 5 - corrections #165

entropidelic opened this issue Oct 20, 2022 · 0 comments

Comments

@entropidelic
Copy link
Collaborator

entropidelic commented Oct 20, 2022

  • In Julia, there are a few PPLs being developed, and we will be using two of them, Turing.l!jl and Soss.jl. We will be focusing on some examples to explain the general approach when using this tools.

    Here we mention that we are going to use Soss.jl, but we ended up only using Turing.jl. This should be fixed unless we add Soss.jl to the chapter.

  • We should mention the libraries we are going to use beside Turing.jl and import them in the code. These libraries are:

    • Distributions: For everything related to the sampling from common probability distributions.
    • StatsPlots: For plotting distributions.
    • Turing (It was mentioned but not imported).
      So the block:
    using Distributions
    using StatsPlots
    using Turing
    

    should be in some place at the beginning of the chapter.

  • The plotting code should be more consistent; for setting the labels we sometimes do that inside the plot() function with the xlabel and ylabel keyword arguments and sometimes we do it outside the plotting functions with the xlabel!() and ylabel!() calls. I think we should do it all inside. This should be done for all the plotting code of the chapter.

  • Change all this code:

    begin
         p_summary = chain[:p]
         plot(p_summary, seriestype = :histogram, normed=true, legend=false, size=(500, 250), color="purple", alpha=0.7)
         title!("Posterior distribution of p after getting tails")
         ylabel!("Probability")
         xlabel!("p")
    end
    

    to

    histogram(chain[:p], xlabel="p", ylabel="Probability", title="Posterior distribution of p after getting tails")
    
  • Change this code:

    begin
        plots = histogram.(samples, normalized=true, legend=false, bins=10);
        p_ = plot(plots[1], plots[2], plots[3], plots[4], plots[5], plots[6], plots[7],plots[8], plots[9], layout = 9 , title = ["$i outcomes" for j in 1:1, i in 2:10], titleloc = :right, titlefont = font(8))
    end
    

    to

    plots = [histogram(samples[i], normalized=true, legend=false, bins=10, title="$(i+1) outcomes", titlefont = font(8)) for i in 1:9];
    plot(plots...)
    
  • Change this code:

    begin
        plots_ = histogram.(samples_beta_prior, normalized=true, legend=false, bins=10, color="red", alpha=0.6);
        p__ = plot(plots_[1], plots_[2], plots_[3], plots_[4], plots_[5], plots_[6], plots_[7], plots_[8], plots_[9], layout = 9, title = ["$i outcomes" for j in 1:1, i in 2:10], titleloc = :right, titlefont = font(8))
    end
    

    to

     plots = [histogram(samples_beta_prior[i], normalized=true, legend=false, bins=10, title="$(i+1) outcomes", titlefont = font(10), color="red", alpha=0.6) for i in 1:9];
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant