From 7db86512b15b968ead8dceae1ff5d87b99503d68 Mon Sep 17 00:00:00 2001 From: Kai Xu Date: Tue, 20 Aug 2019 16:09:49 +0100 Subject: [PATCH] optimize Gaussian model for Turing --- Models/Gaussian/Gaussian_Models.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Models/Gaussian/Gaussian_Models.jl b/Models/Gaussian/Gaussian_Models.jl index 5994fef..6fbfd1d 100644 --- a/Models/Gaussian/Gaussian_Models.jl +++ b/Models/Gaussian/Gaussian_Models.jl @@ -1,9 +1,9 @@ +using FillArrays + @model AHMCGaussian(y, N) = begin mu ~ Normal(0, 1) sigma ~ Truncated(Cauchy(0, 5), 0, Inf) - for n = 1:N - y[n] ~ Normal(mu, sigma) - end + y ~ MvNormal(Fill(mu, N), sigma) # use `Fill(mu, N)` is memory freiendly end AHMCconfig = Turing.NUTS(2000, 1000, .85)