# Probabilistic Programming

**URL:** https://discourse.julialang.org/c/domain/probprog/48.md?page=10

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 11

---

## [Linear regression Gibbs sampler](https://discourse.julialang.org/t/linear-regression-gibbs-sampler/62817)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 2\
**Last updated:** [July 3, 2021, 11:06am UTC](https://discourse.julialang.org/t/linear-regression-gibbs-sampler/62817 "2021-07-03T11:06:53Z")

</div>

I tried to copy this Python sampler Gibbs sampling for Bayesian linear regression in Python | Kieran R Campbell - blog but my Julia implementation returns unexpected numbers. What am I doing wrong? using Distributions…

---

## [Using intermediate results in conditional Gibbs in Turing](https://discourse.julialang.org/t/using-intermediate-results-in-conditional-gibbs-in-turing/58203)

<div class="topic-metadata">

**Author:** [@jbmuir](https://discourse.julialang.org/u/jbmuir)\
**Replies:** 2\
**Last updated:** [July 2, 2021, 5:12am UTC](https://discourse.julialang.org/t/using-intermediate-results-in-conditional-gibbs-in-turing/58203 "2021-07-02T05:12:08Z")

</div>

I have a problem with an expensive intermediate computation that I have to use both within the normal model definition, and in a conditional Gibbs update - is there some way that I can reuse the computation directly in t…

---

## [Constrained parameter in Turing](https://discourse.julialang.org/t/constrained-parameter-in-turing/63869)

<div class="topic-metadata">

**Author:** [@Farlein](https://discourse.julialang.org/u/Farlein)\
**Replies:** 8\
**Last updated:** [July 1, 2021, 7:38pm UTC](https://discourse.julialang.org/t/constrained-parameter-in-turing/63869 "2021-07-01T19:38:23Z")

</div>

Hi there, I get “ERROR: ArgumentError: Bernoulli: the condition zero(p) \<= p \<= one(p) is not satisfied.” from the code below, when using Turing to fit parameters with a constrain, α\_1 + β\_1 \* t \<=0. From the error, I t…

---

## [Can't get a user defined function to work in my Turing Model specification](https://discourse.julialang.org/t/cant-get-a-user-defined-function-to-work-in-my-turing-model-specification/63487)

<div class="topic-metadata">

**Author:** [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Replies:** 6\
**Last updated:** [June 27, 2021, 8:02am UTC](https://discourse.julialang.org/t/cant-get-a-user-defined-function-to-work-in-my-turing-model-specification/63487 "2021-06-27T08:02:56Z")

</div>

I have this simple Turing model which I cannot get to work. The full MWE is given below. using Turing, Distributions function myfilter(x::AbstractVector, λ) xnew = x xnew\[1\] = x\[1\] for i in 2:length(x) …

---

## [Gradient and directional second derivative with ForwardDiff](https://discourse.julialang.org/t/gradient-and-directional-second-derivative-with-forwarddiff/63429)

<div class="topic-metadata">

**Author:** [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Replies:** 3\
**Last updated:** [June 23, 2021, 1:04pm UTC](https://discourse.julialang.org/t/gradient-and-directional-second-derivative-with-forwarddiff/63429 "2021-06-23T13:04:39Z")

</div>

So I have a function f (minus the log-likelihood ℓ retrieved from Turing in my case) and I need two things: 1.) gradient (∇f)(x) in some point x 2.) and how it changes in a direction θ: ∂ₜ(t -\> ∇f(x + t\*θ)) in t = 0 …

---

## [How to understand GP extrapolation shape](https://discourse.julialang.org/t/how-to-understand-gp-extrapolation-shape/62765)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 3\
**Last updated:** [June 21, 2021, 7:15am UTC](https://discourse.julialang.org/t/how-to-understand-gp-extrapolation-shape/62765 "2021-06-21T07:15:38Z")

</div>

using CairoMakie using KernelFunctions using AbstractGPs n = 30 x\_train = rand(n) .+ 1 y\_train = log.(x\_train) f = GP(Matern52Kernel()) fx = f(x\_train, 0.1) p\_fx = posterior(fx, y\_train) fig = Figure() Axis(fig\[1…

---

## [SMC with HMC Kernel](https://discourse.julialang.org/t/smc-with-hmc-kernel/62238)

<div class="topic-metadata">

**Author:** [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Replies:** 3\
**Last updated:** [June 21, 2021, 7:06am UTC](https://discourse.julialang.org/t/smc-with-hmc-kernel/62238 "2021-06-21T07:06:53Z")

</div>

Is it possible to use an HMC or NUTS kernel with Turing’s SMC methods, e.g. as described here and implemented in TensorFlow Probability (which allows for using arbitrary kernels)?

---

## [Slow hierarchical ODE model with Turing](https://discourse.julialang.org/t/slow-hierarchical-ode-model-with-turing/63145)

<div class="topic-metadata">

**Author:** [@PavanChaggar](https://discourse.julialang.org/u/PavanChaggar)\
**Replies:** 4\
**Last updated:** [June 18, 2021, 8:03pm UTC](https://discourse.julialang.org/t/slow-hierarchical-ode-model-with-turing/63145 "2021-06-18T20:03:51Z")

</div>

Hello, I’m having a great deal of trouble with the current model I’m working on. I’ve talked about it in slack but still struggling so apologies for cross posting. It’s an hierarchical model with 30 subjects, each of w…

---

## [Free Workshop on Bayesian Statistics using Turing.jl](https://discourse.julialang.org/t/free-workshop-on-bayesian-statistics-using-turing-jl/62571)

<div class="topic-metadata">

**Author:** [@Storopoli](https://discourse.julialang.org/u/Storopoli)\
**Replies:** 5\
**Last updated:** [June 15, 2021, 8:11am UTC](https://discourse.julialang.org/t/free-workshop-on-bayesian-statistics-using-turing-jl/62571 "2021-06-15T08:11:38Z")

</div>

I’ve got invited to give a workshop about Bayesian Inference using Julia and Turing.jl at Stuttgart Julia Programming Language Meetup. Saturday 12th June. The workshop will be using a Reactive Pluto notebook. The code …

---

## [Gibbs sampling with Gen.jl or best ppl for complicated model](https://discourse.julialang.org/t/gibbs-sampling-with-gen-jl-or-best-ppl-for-complicated-model/62466)

<div class="topic-metadata">

**Author:** [@EvoArt](https://discourse.julialang.org/u/EvoArt)\
**Replies:** 2\
**Last updated:** [June 13, 2021, 10:50pm UTC](https://discourse.julialang.org/t/gibbs-sampling-with-gen-jl-or-best-ppl-for-complicated-model/62466 "2021-06-13T22:50:59Z")

</div>

I’m trying to implement a model, described here. It requires Langevin MC, spike slab priors and Gibbs steps. of the Julia PPLs, Gen.jl seems like the best fit overall, due to the flexibility of building your own sampling…

---

## [Help with Bayesian Latent Variable Model](https://discourse.julialang.org/t/help-with-bayesian-latent-variable-model/61651)

<div class="topic-metadata">

**Author:** [@michielver](https://discourse.julialang.org/u/michielver)\
**Replies:** 2\
**Last updated:** [May 30, 2021, 8:37am UTC](https://discourse.julialang.org/t/help-with-bayesian-latent-variable-model/61651 "2021-05-30T08:37:14Z")

</div>

Hi everyone, I am currently running into some issues with a Latent Variable Model I am trying to set up. I already simplified the model a few times, because I first want to get the simplest idea working and then build u…

---

## [Running TemporalGPs/Stheno sampling](https://discourse.julialang.org/t/running-temporalgps-stheno-sampling/59780)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 25\
**Last updated:** [May 29, 2021, 2:14pm UTC](https://discourse.julialang.org/t/running-temporalgps-stheno-sampling/59780 "2021-05-29T14:14:19Z")

</div>

I want to try sampling with TemporalGPs because it may be faster on larger data, as mentioned in another thread. The docs say to use Stheno’s examples for reference so I tried that. I had some issues and questions: II…

---

## [Turing.jl: Confusion about random variables and draws from distributions](https://discourse.julialang.org/t/turing-jl-confusion-about-random-variables-and-draws-from-distributions/61912)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 3\
**Last updated:** [May 28, 2021, 7:48am UTC](https://discourse.julialang.org/t/turing-jl-confusion-about-random-variables-and-draws-from-distributions/61912 "2021-05-28T07:48:42Z")

</div>

Hi, I’m just starting out with probabilistic programming in general and Turing.jl specifically, so I am still in the process of wrapping my head around the logic of it. I want to build a simple model where a yes/no resp…

---

## [Bayesian logistic regression with Turing.jl](https://discourse.julialang.org/t/bayesian-logistic-regression-with-turing-jl/60105)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 29\
**Last updated:** [May 18, 2021, 4:55pm UTC](https://discourse.julialang.org/t/bayesian-logistic-regression-with-turing-jl/60105 "2021-05-18T16:55:27Z")

</div>

Hi everyone, first-time user of Turing.jl here. It is really nice, thanks! :star: I am trying to implement a simple Bayesian logistic regression model, but I keep getting this warning from AdvancedHMC.jl: ┌ Warning: Th…

---

## [Please tell me about the following Turing.jl processing](https://discourse.julialang.org/t/please-tell-me-about-the-following-turing-jl-processing/61202)

<div class="topic-metadata">

**Author:** [@anon20242138](https://discourse.julialang.org/u/anon20242138)\
**Replies:** 1\
**Last updated:** [May 15, 2021, 5:37pm UTC](https://discourse.julialang.org/t/please-tell-me-about-the-following-turing-jl-processing/61202 "2021-05-15T17:37:37Z")

</div>

What does the following process mean? What does “Observe each prediction.” mean? This code from Turing tutorials ( https://turing.ml/dev/tutorials/3-bayesnn/ ) for i = 1:length(ts) ts\[i\] ~ Bernoulli(preds\[i\]) end

---

## [Confusion about parameter interpretation in Turing documentation](https://discourse.julialang.org/t/confusion-about-parameter-interpretation-in-turing-documentation/54655)

<div class="topic-metadata">

**Author:** [@zenkavi](https://discourse.julialang.org/u/zenkavi)\
**Replies:** 10\
**Last updated:** [May 14, 2021, 3:36am UTC](https://discourse.julialang.org/t/confusion-about-parameter-interpretation-in-turing-documentation/54655 "2021-05-14T03:36:16Z")

</div>

In the Inference of a SDE section og the Turing tutorials the noise added to the states are described in the noise model with the \\phi parameters. Is \\sigma supposed to capture observation noise? What is its true value?

---

## [Difference between Inference methods in BayesNet.jl](https://discourse.julialang.org/t/difference-between-inference-methods-in-bayesnet-jl/61023)

<div class="topic-metadata">

**Author:** [@ashwanimalviya](https://discourse.julialang.org/u/ashwanimalviya)\
**Replies:** 0\
**Last updated:** [May 12, 2021, 1:36pm UTC](https://discourse.julialang.org/t/difference-between-inference-methods-in-bayesnet-jl/61023 "2021-05-12T13:36:05Z")

</div>

Hi Guys, Can someone please suggest to me where can I get more details to understand the difference between the attached InferenceMethods. Thanks in advance.

---

## [Complicated GMM in Turing.jl - StackOverFlow error](https://discourse.julialang.org/t/complicated-gmm-in-turing-jl-stackoverflow-error/60876)

<div class="topic-metadata">

**Author:** [@Michaela\_Maskova](https://discourse.julialang.org/u/Michaela_Maskova)\
**Replies:** 4\
**Last updated:** [May 11, 2021, 3:45pm UTC](https://discourse.julialang.org/t/complicated-gmm-in-turing-jl-stackoverflow-error/60876 "2021-05-11T15:45:20Z")

</div>

Hey everyone, I’m trying to create a MGMM model from paper http://proceedings.mlr.press/v15/xiong11a/xiong11a.pdf. The idea is that I have a dataset D = \[G\_1, \\dots, G\_M\], where each group consists of vectors G\_M = \[x\_1…

---

## [Using TransformVariables.jl to Numerically Handle Jacobian Adjustment of Simple Problem](https://discourse.julialang.org/t/using-transformvariables-jl-to-numerically-handle-jacobian-adjustment-of-simple-problem/60677)

<div class="topic-metadata">

**Author:** [@Adam\_Fleischhacker](https://discourse.julialang.org/u/Adam_Fleischhacker)\
**Replies:** 1\
**Last updated:** [May 7, 2021, 1:12pm UTC](https://discourse.julialang.org/t/using-transformvariables-jl-to-numerically-handle-jacobian-adjustment-of-simple-problem/60677 "2021-05-07T13:12:19Z")

</div>

Here is a simple generative DAG where a Jacobian adjustment is required to get the logpdf of the posterior distribution for y. I can code this function to work with the DynamicHMC.jl suite of packages if I manually a…

---

## [Multivariate Binomial Variable](https://discourse.julialang.org/t/multivariate-binomial-variable/60617)

<div class="topic-metadata">

**Author:** [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Replies:** 0\
**Last updated:** [May 6, 2021, 3:22am UTC](https://discourse.julialang.org/t/multivariate-binomial-variable/60617 "2021-05-06T03:22:44Z")

</div>

I’m trying to build a model for a situation where I have a vector of binomial trials, all of which are correlated. Stan has a useful tutorial for the special case where the trials are all Bernoulli trials and I want to u…

---

## [Faster gp fitting on million observations?](https://discourse.julialang.org/t/faster-gp-fitting-on-million-observations/59519)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 15\
**Last updated:** [May 4, 2021, 1:51am UTC](https://discourse.julialang.org/t/faster-gp-fitting-on-million-observations/59519 "2021-05-04T01:51:57Z")

</div>

I have a million-observation regression problem with one outcome and several predictors, including a time variable. I would like to fit the over-time variation with a Gaussian process. I tried using AbstractGPs with Dyna…

---

## [Am I creating distributions wrong in Turing?](https://discourse.julialang.org/t/am-i-creating-distributions-wrong-in-turing/60142)

<div class="topic-metadata">

**Author:** [@pthompson234](https://discourse.julialang.org/u/pthompson234)\
**Replies:** 11\
**Last updated:** [May 4, 2021, 1:21am UTC](https://discourse.julialang.org/t/am-i-creating-distributions-wrong-in-turing/60142 "2021-05-04T01:21:24Z")

</div>

Hello, I’m using Turing and having some issues. To reproduce this, I’ll provide about as simple of an example as I can generate. Let’s take the basic example from the docs (Probabilistic Programming in Thirty Seconds) an…

---

## [DynamicHMC for Bayesian inference where product distribution is observed - Possible?](https://discourse.julialang.org/t/dynamichmc-for-bayesian-inference-where-product-distribution-is-observed-possible/60268)

<div class="topic-metadata">

**Author:** [@Adam\_Fleischhacker](https://discourse.julialang.org/u/Adam_Fleischhacker)\
**Replies:** 9\
**Last updated:** [May 3, 2021, 11:50pm UTC](https://discourse.julialang.org/t/dynamichmc-for-bayesian-inference-where-product-distribution-is-observed-possible/60268 "2021-05-03T23:50:48Z")

</div>

Here is a generative model I am working on. Think of a game show where your winnings are determined by the product of two RV’s: winningsMultiplier(X) and maxWinnings(Y). We observe winnings w\_i = x\_i \* y. Our prior o…

---

## [Way to Avoid Checking Parameters Fall in Bounds for Distributions.jl](https://discourse.julialang.org/t/way-to-avoid-checking-parameters-fall-in-bounds-for-distributions-jl/59436)

<div class="topic-metadata">

**Author:** [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Replies:** 8\
**Last updated:** [April 30, 2021, 1:35am UTC](https://discourse.julialang.org/t/way-to-avoid-checking-parameters-fall-in-bounds-for-distributions-jl/59436 "2021-04-30T01:35:32Z")

</div>

Is there a way to avoid checking whether parameters for a distribution fall within the required bounds (e.g. positives only for beta-binomial)? It should make sampling with Turing.jl faster, and can also be helpful when …

---

## [Error in simple Turing model with ReverseDiff](https://discourse.julialang.org/t/error-in-simple-turing-model-with-reversediff/60128)

<div class="topic-metadata">

**Author:** [@opera\_malenky](https://discourse.julialang.org/u/opera_malenky)\
**Replies:** 6\
**Last updated:** [April 29, 2021, 2:56pm UTC](https://discourse.julialang.org/t/error-in-simple-turing-model-with-reversediff/60128 "2021-04-29T14:56:40Z")

</div>

I had a model that was running until about two weeks ago, but suddenly stopped. I thought I’d post here before filing an issue - it’s not clear to me if this is more of a reversediff issue or a Turing issue or something …

---

## [Avoiding loops in Turing](https://discourse.julialang.org/t/avoiding-loops-in-turing/59830)

<div class="topic-metadata">

**Author:** [@owensnick](https://discourse.julialang.org/u/owensnick)\
**Replies:** 7\
**Last updated:** [April 26, 2021, 3:10pm UTC](https://discourse.julialang.org/t/avoiding-loops-in-turing/59830 "2021-04-26T15:10:32Z")

</div>

I’m learning Turing. Can anyone help explain the following, I define two (hopefully) equivalent models one with loops and one without, the loop model is 50x slower, but actually produces useful results. This is a reduced…

---

## [Discretized HMC](https://discourse.julialang.org/t/discretized-hmc/59964)

<div class="topic-metadata">

**Author:** [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Replies:** 1\
**Last updated:** [April 25, 2021, 2:25pm UTC](https://discourse.julialang.org/t/discretized-hmc/59964 "2021-04-25T14:25:48Z")

</div>

Is there any interest in implementing generalizations of HMC to discrete spaces for Turing.jl? Examples: https://www.tandfonline.com/doi/full/10.1080/01621459.2019.1585255?casa\_token=XuidyAblCZQAAAAA:FrOpfFdJWbBrG1R0-ZN…

---

## [Using a posterior from a previous sample as a prior](https://discourse.julialang.org/t/using-a-posterior-from-a-previous-sample-as-a-prior/59914)

<div class="topic-metadata">

**Author:** [@pthompson234](https://discourse.julialang.org/u/pthompson234)\
**Replies:** 2\
**Last updated:** [April 25, 2021, 2:00am UTC](https://discourse.julialang.org/t/using-a-posterior-from-a-previous-sample-as-a-prior/59914 "2021-04-25T02:00:34Z")

</div>

Sorry if this is a question that has already been asked, or if this is the wrong place for something like this - I’ve done a bit of searching and haven’t found anything that works for the Turing package. In short, what I…

---

## [Importing CairoMakie prevents sampling](https://discourse.julialang.org/t/importing-cairomakie-prevents-sampling/59501)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 7\
**Last updated:** [April 22, 2021, 8:47am UTC](https://discourse.julialang.org/t/importing-cairomakie-prevents-sampling/59501 "2021-04-22T08:47:42Z")

</div>

I have a script that runs fine unless I have import CairoMakie at the top. Then it hangs. How can I diagnose this? It hangs at mcmc\_with\_warmup. The same thing happens whether I have using CairoMakie or import CairoMaki…

---

## [AGP with linear predictors](https://discourse.julialang.org/t/agp-with-linear-predictors/59630)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 3\
**Last updated:** [April 21, 2021, 4:50pm UTC](https://discourse.julialang.org/t/agp-with-linear-predictors/59630 "2021-04-21T16:50:14Z")

</div>

Continuing my experiments from another thread using the suggestion of @theogf, I have some code using AGP. With a single predictor I can fit: using AugmentedGaussianProcesses const AGP = AugmentedGaussianProcesses using…

[Previous page](https://discourse.julialang.org/c/domain/probprog/48.md?page=9)

[Next page](https://discourse.julialang.org/c/domain/probprog/48.md?page=11)
