From deda1ef75c00a89f366387a676f2656570fa23c7 Mon Sep 17 00:00:00 2001 From: Pietro Monticone <38562595+pitmonticone@users.noreply.github.com> Date: Wed, 20 Apr 2022 17:57:56 +0200 Subject: [PATCH 1/5] Update README.md Fix a typo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b391b1c..b2c61270 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Welcome to the repository of tutorials on how to do **Bayesian Statistics** usin ## Turing -[**Turing**](http://turing.ml/) is a ecosystem of Julia packages for Bayesian Inference using [probabilistic programming](https://en.wikipedia.org/wiki/Probabilistic_programming). Models specified using Turing are easy to read and write — models work the way you write them. Like everything in Julia, Turing is [fast](https://arxiv.org/abs/2002.02702). +[**Turing**](http://turing.ml/) is an ecosystem of Julia packages for Bayesian Inference using [probabilistic programming](https://en.wikipedia.org/wiki/Probabilistic_programming). Models specified using Turing are easy to read and write — models work the way you write them. Like everything in Julia, Turing is [fast](https://arxiv.org/abs/2002.02702). ## Author From e4dcb4398a291301c2110e2f44dcd6b95fd0fb64 Mon Sep 17 00:00:00 2001 From: Pietro Monticone <38562595+pitmonticone@users.noreply.github.com> Date: Wed, 20 Apr 2022 17:58:19 +0200 Subject: [PATCH 2/5] Update index.md Fix a typo. --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index e662ba14..50ed7fe3 100644 --- a/index.md +++ b/index.md @@ -26,7 +26,7 @@ Welcome to the repository of tutorials on how to do **Bayesian Statistics** usin ## Turing -[**Turing**](http://turing.ml/) is a ecosystem of Julia packages for Bayesian Inference using [probabilistic programming](https://en.wikipedia.org/wiki/Probabilistic_programming). Models specified using Turing are easy to read and write — models work the way you write them. Like everything in Julia, Turing is [fast](https://arxiv.org/abs/2002.02702). +[**Turing**](http://turing.ml/) is an ecosystem of Julia packages for Bayesian Inference using [probabilistic programming](https://en.wikipedia.org/wiki/Probabilistic_programming). Models specified using Turing are easy to read and write — models work the way you write them. Like everything in Julia, Turing is [fast](https://arxiv.org/abs/2002.02702). ## Author From 9dc3e88ca2dad734a2e0256912d010f6bc288895 Mon Sep 17 00:00:00 2001 From: Pietro Monticone <38562595+pitmonticone@users.noreply.github.com> Date: Wed, 20 Apr 2022 18:23:32 +0200 Subject: [PATCH 3/5] Update 1_why_Julia.jl Fixed a few typos. --- _literate/1_why_Julia.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_literate/1_why_Julia.jl b/_literate/1_why_Julia.jl index 8f1570b0..b33518a1 100644 --- a/_literate/1_why_Julia.jl +++ b/_literate/1_why_Julia.jl @@ -127,11 +127,11 @@ # ## Ease of Use -# What is most striking that Julia can be as fast as C (and faster than Java in some applications) while **having a very simple and +# What is most striking is that Julia can be as fast as C (and faster than Java in some applications) while **having a very simple and # intelligible syntax**. This feature along with its speed is what Julia creators denote as **"the two language problem"** that Julia -# address. The **"two language problem" is a very typical situation in scientific computing** where a researcher or computer scientist +# addresses. The **"two language problem" is a very typical situation in scientific computing** where a researcher or computer scientist # devises an algorithm or a solution that he or she prototypes in an easy to code language (like Python) and, if it works, he or she -# would code in a fast language that is not easy to code (C or FORTRAN). Thus, we have two languages involved in the process of +# would code in a fast language that is not easy to code (C or FORTRAN). Thus, we have two languages involved in the process # of developing a new solution. One which is easy to prototype but is not suited for implementation (mostly due to being slow). # And another one which is not so easy to code (and, consequently, not easy to prototype) but suited for implementation # (mostly because it is fast). Julia comes to **eliminate such situations** by being the **same language** that you **prototype** (ease of use) From 6b01e5ed226232806e0c32e8d53d5b3241d6f298 Mon Sep 17 00:00:00 2001 From: Pietro Monticone <38562595+pitmonticone@users.noreply.github.com> Date: Fri, 24 Jun 2022 02:18:05 +0200 Subject: [PATCH 4/5] Fixed a few typos --- _literate/1_why_Julia.jl | 2 +- _literate/2_bayes_stats.jl | 2 +- _literate/5_MCMC.jl | 4 ++-- _literate/7_logistic_reg.jl | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_literate/1_why_Julia.jl b/_literate/1_why_Julia.jl index e4f1e008..84b2069a 100644 --- a/_literate/1_why_Julia.jl +++ b/_literate/1_why_Julia.jl @@ -317,7 +317,7 @@ # $$ \text{PDF}(\boldsymbol{\mu}, \boldsymbol{\Sigma}) = (2\pi)^{-{\frac{k}{2}}}\det({\boldsymbol{\Sigma}})^{-{\frac {1}{2}}}e^{-{\frac{1}{2}}(\mathbf{x}-{\boldsymbol{\mu}})^{T}{\boldsymbol{\Sigma }}^{-1}(\mathbf{x} -{\boldsymbol{\mu}})} \label{mvnpdf} , $$ # # where $\boldsymbol{\mu}$ is a vector of means, $k$ is the number of dimensions, $\boldsymbol{\Sigma}$ is a covariance matrix, $\det$ is the determinant and $\mathbf{x}$ -# is a vector of values that the PDF is evaluted for. +# is a vector of values that the PDF is evaluated for. # **SPOILER ALERT**: Julia will beat this C++ Eigen implementation by being almost 100x faster. So I will try to *help* C++ beat Julia (😂) # by making a bivariate normal class `BiNormal` in order to avoid the expensive operation of inverting a covariance matrix and computing diff --git a/_literate/2_bayes_stats.jl b/_literate/2_bayes_stats.jl index 2163f597..84269215 100644 --- a/_literate/2_bayes_stats.jl +++ b/_literate/2_bayes_stats.jl @@ -408,7 +408,7 @@ # an interval in which we are sure that the value of the parameter of interest is, based on the likelihood conditioned on the observed # data - $P(y \mid \theta)$; and the prior probability of the parameter of interest - $P(\theta)$. It is basically a "slice" of # the posterior probability of the parameter restricted to a certain level of certainty. For example: a 95% credibility interval -# shows the interval that we are 95% sure that captures the value of our parameter of intereest. That simple... +# shows the interval that we are 95% sure that captures the value of our parameter of interest. That simple... # For example, see figure below, which shows a Log-Normal distribution with mean 0 and standard deviation 2. The green dot # shows the maximum likelihood estimation (MLE) of the value of $\theta$ which is simply the mode of distribution. And in diff --git a/_literate/5_MCMC.jl b/_literate/5_MCMC.jl index 5c7392fc..508dbfd9 100644 --- a/_literate/5_MCMC.jl +++ b/_literate/5_MCMC.jl @@ -1239,8 +1239,8 @@ savefig(joinpath(@OUTPUT, "traceplot_bad_chain.svg")); # hide # If your Bayesian model has problems with convergence there are some steps that can be tried[^QR]. # Listed here from the simplest to the most complex: -# 1. **Increase the number of iterations and chains**: First option is to increase the number of MCMC iterations and it is also possible to increase the number of paralle chains to be sampled. -# 2. **Model reparametrization**: the second option is to reparameterize the model. There are two ways to parameterize the model: the first with centered parameterization (CP) and the second with non-centered parameterization (NCP). NCP is most useful in Multilevel Models, therefore we will cover NCP in [10. **Multilevel Models**](/pages/10_multilevel_models/). +# 1. **Increase the number of iterations and chains**: First option is to increase the number of MCMC iterations and it is also possible to increase the number of parallel chains to be sampled. +# 2. **Model reparametrization**: the second option is to reparametrize the model. There are two ways to parameterize the model: the first with centered parametrization (CP) and the second with non-centered parameterization (NCP). NCP is most useful in Multilevel Models, therefore we will cover NCP in [10. **Multilevel Models**](/pages/10_multilevel_models/). # 3. **Collect more data**: sometimes the model is too complex and we need a larger sample to get stable estimates. # 4. **Rethink the model**: convergence failure when we have adequate sampling is usually due to a specification of priors and likelihood function that are not compatible with the data. In this case, it is necessary to rethink the data's generative process in which the model's assumptions are anchored. diff --git a/_literate/7_logistic_reg.jl b/_literate/7_logistic_reg.jl index f3fd3bdb..eb1c97ae 100644 --- a/_literate/7_logistic_reg.jl +++ b/_literate/7_logistic_reg.jl @@ -50,7 +50,7 @@ savefig(joinpath(@OUTPUT, "logistic.svg")); # hide # Logistic regression would add the logistic function to the linear term: # * $\hat{p} = \text{Logistic}(\text{Linear}) = \frac{1}{1 + e^{-\operatorname{Linear}}}$ - predicted probability of the observation being the value 1 -# * $\hat{\mathbf{y}}=\left\{\begin{array}{ll} 0 & \text { if } \hat{p} < 0.5 \\ 1 & \text { if } \hat{p} \geq 0.5 \end{array}\right.$ - predicted discreve value of $\mathbf{y}$ +# * $\hat{\mathbf{y}}=\left\{\begin{array}{ll} 0 & \text { if } \hat{p} < 0.5 \\ 1 & \text { if } \hat{p} \geq 0.5 \end{array}\right.$ - predicted discrete value of $\mathbf{y}$ # **Example**: From c87e69acda08c047d18b62f219900a4822fd9939 Mon Sep 17 00:00:00 2001 From: Pietro Monticone <38562595+pitmonticone@users.noreply.github.com> Date: Sat, 25 Jun 2022 17:14:36 +0200 Subject: [PATCH 5/5] Update _literate/5_MCMC.jl Co-authored-by: Jose Storopoli --- _literate/5_MCMC.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_literate/5_MCMC.jl b/_literate/5_MCMC.jl index 508dbfd9..a16e4aa5 100644 --- a/_literate/5_MCMC.jl +++ b/_literate/5_MCMC.jl @@ -1240,7 +1240,7 @@ savefig(joinpath(@OUTPUT, "traceplot_bad_chain.svg")); # hide # Listed here from the simplest to the most complex: # 1. **Increase the number of iterations and chains**: First option is to increase the number of MCMC iterations and it is also possible to increase the number of parallel chains to be sampled. -# 2. **Model reparametrization**: the second option is to reparametrize the model. There are two ways to parameterize the model: the first with centered parametrization (CP) and the second with non-centered parameterization (NCP). NCP is most useful in Multilevel Models, therefore we will cover NCP in [10. **Multilevel Models**](/pages/10_multilevel_models/). +# 2. **Model reparameterization**: the second option is to reparameterize the model. There are two ways to parameterize the model: the first with centered parameterization (CP) and the second with non-centered parameterization (NCP). NCP is most useful in Multilevel Models, therefore we will cover NCP in [10. **Multilevel Models**](/pages/10_multilevel_models/). # 3. **Collect more data**: sometimes the model is too complex and we need a larger sample to get stable estimates. # 4. **Rethink the model**: convergence failure when we have adequate sampling is usually due to a specification of priors and likelihood function that are not compatible with the data. In this case, it is necessary to rethink the data's generative process in which the model's assumptions are anchored.