From efce4471c97897e4929fb7968a2408e02ac7466f Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Wed, 6 Nov 2024 08:21:32 +0000 Subject: [PATCH 1/2] Replace truncated(d, 0, Inf) -> truncated(d; lower=0) (#549) --- tutorials/docs-13-using-turing-performance-tips/index.qmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tutorials/docs-13-using-turing-performance-tips/index.qmd b/tutorials/docs-13-using-turing-performance-tips/index.qmd index 6eca73ee8..9dd73d752 100755 --- a/tutorials/docs-13-using-turing-performance-tips/index.qmd +++ b/tutorials/docs-13-using-turing-performance-tips/index.qmd @@ -81,7 +81,7 @@ The following example with abstract types p, n = size(x) params = Vector{Real}(undef, n) for i in 1:n - params[i] ~ truncated(Normal(), 0, Inf) + params[i] ~ truncated(Normal(); lower=0) end a = x * params @@ -96,7 +96,7 @@ can be transformed into the following representation with concrete types: p, n = size(x) params = Vector{T}(undef, n) for i in 1:n - params[i] ~ truncated(Normal(), 0, Inf) + params[i] ~ truncated(Normal(); lower=0) end a = x * params @@ -108,7 +108,7 @@ Alternatively, you could use `filldist` in this example: ```{julia} @model function tmodel(x, y) - params ~ filldist(truncated(Normal(), 0, Inf), size(x, 2)) + params ~ filldist(truncated(Normal(); lower=0), size(x, 2)) a = x * params return y ~ MvNormal(a, I) end From 4ec5d7f472c5d1fb7e5d0e65739485699224aac1 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Wed, 6 Nov 2024 10:45:10 +0000 Subject: [PATCH 2/2] Episode V: Replace truncated(d, 0, Inf) -> truncated(d; lower=0) (#550) * Replace truncated(d, 0, Inf) -> truncated(d; lower=0) * One more --- tutorials/09-variational-inference/index.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/09-variational-inference/index.qmd b/tutorials/09-variational-inference/index.qmd index 56acb3208..ef9643756 100755 --- a/tutorials/09-variational-inference/index.qmd +++ b/tutorials/09-variational-inference/index.qmd @@ -332,7 +332,7 @@ test = Matrix(test_cut[:, remove_names]); # Bayesian linear regression. @model function linear_regression(x, y, n_obs, n_vars, ::Type{T}=Vector{Float64}) where {T} # Set variance prior. - σ² ~ truncated(Normal(0, 100), 0, Inf) + σ² ~ truncated(Normal(0, 100); lower=0) # Set intercept prior. intercept ~ Normal(0, 3)