# Probabilistic Programming

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

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

**Page:** 3

---

## [What divergence information is available in Turing?](https://discourse.julialang.org/t/what-divergence-information-is-available-in-turing/119246)

<div class="topic-metadata">

**Author:** [@jonask](https://discourse.julialang.org/u/jonask)\
**Replies:** 3\
**Last updated:** [September 18, 2024, 11:52am UTC](https://discourse.julialang.org/t/what-divergence-information-is-available-in-turing/119246 "2024-09-18T11:52:25Z")

</div>

Hi, Semi-new user of Julia and Turing here! I have been using Flux together with Turing to sample from a small NN with NUTS. I have come across different discussions online about where to find information regarding dive…

---

## [Access acceptance rate parameter for AdvancedMH in Turing](https://discourse.julialang.org/t/access-acceptance-rate-parameter-for-advancedmh-in-turing/119149)

<div class="topic-metadata">

**Author:** [@Zoe\_R](https://discourse.julialang.org/u/Zoe_R)\
**Replies:** 5\
**Last updated:** [September 16, 2024, 8:47pm UTC](https://discourse.julialang.org/t/access-acceptance-rate-parameter-for-advancedmh-in-turing/119149 "2024-09-16T20:47:24Z")

</div>

I have a Bayesian model set up using Turing.jl and I am currently using AdvancedMH random walk proposals in the sampler. I would like to check on the acceptance rate (number of accepted proposals/number of proposals) so …

---

## [Turing: selective truncated distribution error](https://discourse.julialang.org/t/turing-selective-truncated-distribution-error/118598)

<div class="topic-metadata">

**Author:** [@Sam\_P](https://discourse.julialang.org/u/Sam_P)\
**Replies:** 1\
**Last updated:** [September 12, 2024, 1:19am UTC](https://discourse.julialang.org/t/turing-selective-truncated-distribution-error/118598 "2024-09-12T01:19:11Z")

</div>

Hi all, I’ve been trying to fit a model to truncated discrete data using Turing, with the aim of recovering the non-truncated distribution’s parameter, and use the fitted model to predict new values based on new truncat…

---

## [Function for resuming mcmc chain](https://discourse.julialang.org/t/function-for-resuming-mcmc-chain/102308)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 13\
**Last updated:** [September 12, 2024, 1:01am UTC](https://discourse.julialang.org/t/function-for-resuming-mcmc-chain/102308 "2024-09-12T01:01:11Z")

</div>

I want to write a function so I will not have to wait for my long inference and get an end result but I will be able to get intermediate results. let’s say if I want to do inference for 100000 iteration. I can get resu…

---

## [Importance Sampling in Turing](https://discourse.julialang.org/t/importance-sampling-in-turing/118179)

<div class="topic-metadata">

**Author:** [@ArnoStrouwen](https://discourse.julialang.org/u/ArnoStrouwen)\
**Replies:** 1\
**Last updated:** [September 12, 2024, 12:57am UTC](https://discourse.julialang.org/t/importance-sampling-in-turing/118179 "2024-09-12T00:57:49Z")

</div>

The summary from importance sampling is very different from NUTS, and just seems to summarize the prior distribution: using Turing @model function gdemo(x, y) s² ~ InverseGamma(2, 3) m ~ Normal(0, sqrt(s²)) …

---

## [Hierarchical proposal in AdvancedMH.jl](https://discourse.julialang.org/t/hierarchical-proposal-in-advancedmh-jl/117204)

<div class="topic-metadata">

**Author:** [@janglaubitz](https://discourse.julialang.org/u/janglaubitz)\
**Replies:** 1\
**Last updated:** [September 12, 2024, 12:44am UTC](https://discourse.julialang.org/t/hierarchical-proposal-in-advancedmh-jl/117204 "2024-09-12T00:44:51Z")

</div>

I am trying to use AdvancedMH.jl within Turing.jl to perform static MH sampling for a hierarchical model: @model function model\_toyProblem\_original( y, σ², β, ϑ ) θ ~ Gamma( β, ϑ ) # hyper-prior model x ~ Norma…

---

## [EM algorithm for HMM-GLM models in Julia?](https://discourse.julialang.org/t/em-algorithm-for-hmm-glm-models-in-julia/119136)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 5\
**Last updated:** [September 6, 2024, 7:42pm UTC](https://discourse.julialang.org/t/em-algorithm-for-hmm-glm-models-in-julia/119136 "2024-09-06T19:42:29Z")

</div>

Hi all, Is there anyone here who tried to use Julia for HMM-GLM models using Expectation Maximization? I’m looking for good references to try it out. I looked at HiddenMarkovModels.jl but I’m not sure how to use it to …

---

## [Pick the value from a result](https://discourse.julialang.org/t/pick-the-value-from-a-result/118713)

<div class="topic-metadata">

**Author:** [@Stephen](https://discourse.julialang.org/u/Stephen)\
**Replies:** 1\
**Last updated:** [August 29, 2024, 8:36am UTC](https://discourse.julialang.org/t/pick-the-value-from-a-result/118713 "2024-08-29T08:36:46Z")

</div>

Here is a solution of a Bayesian inference using RxInfer: julia\> result Inference results: Posteriors | available for (i\_β) julia\> result.posteriors Dict{Symbol, Vector{Dirichlet{Float64, Vector{Float64}, Float…

---

## [MAP optimization in Turing with LBFGS doesn't move at all](https://discourse.julialang.org/t/map-optimization-in-turing-with-lbfgs-doesnt-move-at-all/118431)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 22\
**Last updated:** [August 23, 2024, 3:31pm UTC](https://discourse.julialang.org/t/map-optimization-in-turing-with-lbfgs-doesnt-move-at-all/118431 "2024-08-23T15:31:48Z")

</div>

I’m using maximum\_a\_posteriori to try to find a MAP fit for a complex model that I can’t show you at the moment. If I run it with SAMIN() simulated annealing, or BBO\_de\_... algorithms, it does move around and finds part…

---

## [Turing custom distribution implementation](https://discourse.julialang.org/t/turing-custom-distribution-implementation/117881)

<div class="topic-metadata">

**Author:** [@jmarsh96](https://discourse.julialang.org/u/jmarsh96)\
**Replies:** 4\
**Last updated:** [August 15, 2024, 2:49pm UTC](https://discourse.julialang.org/t/turing-custom-distribution-implementation/117881 "2024-08-15T14:49:29Z")

</div>

Hi, I am fairly new to Julia and have been having trouble implementing custom distributions for use within Turing. The model is defined as follows. Let Y denote the data which we assume are generated by Y = \\theta + X, …

---

## [In Turing.jl get probability of the answer of the datapoint from validation set](https://discourse.julialang.org/t/in-turing-jl-get-probability-of-the-answer-of-the-datapoint-from-validation-set/118103)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 4\
**Last updated:** [August 13, 2024, 2:12pm UTC](https://discourse.julialang.org/t/in-turing-jl-get-probability-of-the-answer-of-the-datapoint-from-validation-set/118103 "2024-08-13T14:12:36Z")

</div>

Hello I am new to probabilistic programming and some (I suppose basic things) Firs my goal is to design model that given set of features will predict binary outcome variable. Hovewer additionally I would like to know a…

---

## [Constrained ordered prior for ordered logistic model](https://discourse.julialang.org/t/constrained-ordered-prior-for-ordered-logistic-model/55670)

<div class="topic-metadata">

**Author:** [@Neal](https://discourse.julialang.org/u/Neal)\
**Replies:** 3\
**Last updated:** [August 2, 2024, 9:16pm UTC](https://discourse.julialang.org/t/constrained-ordered-prior-for-ordered-logistic-model/55670 "2024-08-02T21:16:47Z")

</div>

Hello, I have a task for modeling ordered discrete response outcome but I struggled to make my prior ordered for ordered logistic model so theta\[6\] \> theta\[5\] \> theta\[4\] \> theta\[3\] \> theta\[2\] \> theta\[1\]. In Stan, I can d…

---

## [Condition Turing model on a variable created within the model](https://discourse.julialang.org/t/condition-turing-model-on-a-variable-created-within-the-model/116994)

<div class="topic-metadata">

**Author:** [@DominiqueMakowski](https://discourse.julialang.org/u/DominiqueMakowski)\
**Replies:** 4\
**Last updated:** [July 15, 2024, 4:19pm UTC](https://discourse.julialang.org/t/condition-turing-model-on-a-variable-created-within-the-model/116994 "2024-07-15T16:19:17Z")

</div>

Assuming I have the following variable \[0, 1\] using Downloads, CSV, DataFrames, Random using Turing, Distributions using GLMakie using StatsFuns: logistic y = vcat(rand(Beta(2, 10), 200), rand(Uniform(0, 1), 100), …

---

## [Reparametrized Beta(μ, σ²) in Turing: how to set a prior that depends on another parameter?](https://discourse.julialang.org/t/reparametrized-beta-in-turing-how-to-set-a-prior-that-depends-on-another-parameter/116753)

<div class="topic-metadata">

**Author:** [@DominiqueMakowski](https://discourse.julialang.org/u/DominiqueMakowski)\
**Replies:** 4\
**Last updated:** [July 8, 2024, 3:35pm UTC](https://discourse.julialang.org/t/reparametrized-beta-in-turing-how-to-set-a-prior-that-depends-on-another-parameter/116753 "2024-07-08T15:35:19Z")

</div>

I am trying to model data between \]0, 1\[ using Bayesian regressions in Turing. It is fairly common to use a Mean/Variance parametrization to the Beta (see Wikipedia), allowing to express priors on intuitive quantities. …

---

## [Best, most idiomatic way to implement Bayesian Differential Equations in Turing?](https://discourse.julialang.org/t/best-most-idiomatic-way-to-implement-bayesian-differential-equations-in-turing/116608)

<div class="topic-metadata">

**Author:** [@JasonPekos](https://discourse.julialang.org/u/JasonPekos)\
**Replies:** 3\
**Last updated:** [July 5, 2024, 11:08am UTC](https://discourse.julialang.org/t/best-most-idiomatic-way-to-implement-bayesian-differential-equations-in-turing/116608 "2024-07-05T11:08:54Z")

</div>

Hi! As part of GSOC, I’m working on porting the posteriordb benchmarking suite to Turing. This includes a number of Bayesian differential equations. I’m really interested in putting Julia’s “best foot forwards”, so I’m …

---

## [Save a fitted Turing model to disk](https://discourse.julialang.org/t/save-a-fitted-turing-model-to-disk/116396)

<div class="topic-metadata">

**Author:** [@DominiqueMakowski](https://discourse.julialang.org/u/DominiqueMakowski)\
**Replies:** 4\
**Last updated:** [July 4, 2024, 8:49am UTC](https://discourse.julialang.org/t/save-a-fitted-turing-model-to-disk/116396 "2024-07-04T08:49:19Z")

</div>

I am struggling to find the most straightforward way (using as little additional packages as possible) to save a Chains MCMC chain object (obtained from sampling from a Turing model) on the disk. I would like to be able…

---

## [Turing.jl how to estimate param given a likelihood function](https://discourse.julialang.org/t/turing-jl-how-to-estimate-param-given-a-likelihood-function/115996)

<div class="topic-metadata">

**Author:** [@isaque](https://discourse.julialang.org/u/isaque)\
**Replies:** 1\
**Last updated:** [June 22, 2024, 7:25am UTC](https://discourse.julialang.org/t/turing-jl-how-to-estimate-param-given-a-likelihood-function/115996 "2024-06-22T07:25:03Z")

</div>

I have a cost function \\chi^2(p) \\sim \\sum\_i^{N\_\\text{im}} \[\\beta\_i(p) - \\langle \\beta(p)\\rangle\]^2 and associated likelihood \\mathscr{L}(p) \\sim e^{-\\chi^2/2}. Given a parameter p, the set of \\beta are calculated from…

---

## [ModelingToolkit/ ODESystem in Turing](https://discourse.julialang.org/t/modelingtoolkit-odesystem-in-turing/115700)

<div class="topic-metadata">

**Author:** [@Sam\_P](https://discourse.julialang.org/u/Sam_P)\
**Replies:** 15\
**Last updated:** [June 18, 2024, 12:57am UTC](https://discourse.julialang.org/t/modelingtoolkit-odesystem-in-turing/115700 "2024-06-18T00:57:47Z")

</div>

Hi all, Just been playing around with the DifferentialEquation and ModelingToolkit systems within Turing and spotted the behaviour below. Setting up the system and generating synthetic data: using ModelingToolkit, Di…

---

## [Sample dependent variables in Turing](https://discourse.julialang.org/t/sample-dependent-variables-in-turing/114993)

<div class="topic-metadata">

**Author:** [@swsw](https://discourse.julialang.org/u/swsw)\
**Replies:** 7\
**Last updated:** [June 7, 2024, 8:31am UTC](https://discourse.julialang.org/t/sample-dependent-variables-in-turing/114993 "2024-06-07T08:31:35Z")

</div>

I’d like to sample two variables X1 ~ Uniform(0,1) and X2 ~ Uniform(0, X1) using Turing @model function model() X1 ~ Uniform(1e-5, 1) X2 ~ Uniform(0, X1) end my\_model = model(); sample(my\_model, NUTS(), 10000) …

---

## [Sampling predictive with MvNormal in Turing](https://discourse.julialang.org/t/sampling-predictive-with-mvnormal-in-turing/115292)

<div class="topic-metadata">

**Author:** [@dae](https://discourse.julialang.org/u/dae)\
**Replies:** 2\
**Last updated:** [June 7, 2024, 1:26am UTC](https://discourse.julialang.org/t/sampling-predictive-with-mvnormal-in-turing/115292 "2024-06-07T01:26:02Z")

</div>

tldr; none of these seem to work, and give different errors: Vector{Float64}(undef, n) ~ MvNormal(yhat, Diagonal(fill(1.0, n))) Vector{Real}(undef, n) ~ MvNormal(yhat, Diagonal(fill(1.0, n))) Vector{Missing}(missing, n)…

---

## [Fitting normal-inverse-wishart](https://discourse.julialang.org/t/fitting-normal-inverse-wishart/73273)

<div class="topic-metadata">

**Author:** [@Paul\_McVay](https://discourse.julialang.org/u/Paul_McVay)\
**Replies:** 4\
**Last updated:** [June 4, 2024, 10:06am UTC](https://discourse.julialang.org/t/fitting-normal-inverse-wishart/73273 "2024-06-04T10:06:38Z")

</div>

What library (and method) is recommended for taking a sequence of mean-vectors and covariance matrices and fitting a normal-inverse-wishart distribution? For example, my data is a vector of tuples where the first elemen…

---

## [How to sample ordered variables with different distributions in turing](https://discourse.julialang.org/t/how-to-sample-ordered-variables-with-different-distributions-in-turing/108455)

<div class="topic-metadata">

**Author:** [@gonzalo](https://discourse.julialang.org/u/gonzalo)\
**Replies:** 19\
**Last updated:** [May 29, 2024, 8:26am UTC](https://discourse.julialang.org/t/how-to-sample-ordered-variables-with-different-distributions-in-turing/108455 "2024-05-29T08:26:40Z")

</div>

Hi julia bros, I want to use turing to sample ordered variables each with different distributions. For example, X~Normal(0,1) Y~Exp(1), Z~Uniform(0,1) and require X\>Y\>Z I know this can be done by rejection sampl…

---

## [Differential evolution MCMC in Julia?](https://discourse.julialang.org/t/differential-evolution-mcmc-in-julia/104713)

<div class="topic-metadata">

**Author:** [@fnoessler](https://discourse.julialang.org/u/fnoessler)\
**Replies:** 18\
**Last updated:** [May 26, 2024, 10:32pm UTC](https://discourse.julialang.org/t/differential-evolution-mcmc-in-julia/104713 "2024-05-26T22:32:47Z")

</div>

Hello, is there a Julia package that implements the Differential Evolution MCMC sampler? Is this possible with Turing.jl (I like Turing.jl quite a lot)? At the moment, I use the BayesianTools R package that implements…

---

## [Using MH() with a custom proposal and acceptance rate of 1 to emulate traditional Gibbs?](https://discourse.julialang.org/t/using-mh-with-a-custom-proposal-and-acceptance-rate-of-1-to-emulate-traditional-gibbs/114653)

<div class="topic-metadata">

**Author:** [@aws](https://discourse.julialang.org/u/aws)\
**Replies:** 1\
**Last updated:** [May 24, 2024, 4:01pm UTC](https://discourse.julialang.org/t/using-mh-with-a-custom-proposal-and-acceptance-rate-of-1-to-emulate-traditional-gibbs/114653 "2024-05-24T16:01:46Z")

</div>

Hello, Thank you in advance for reading. I am a researcher considering whether to use Turing for a project. As background, I will be implementing and extending a sparse infinite Bayesian factor model as described in Spa…

---

## [Modelling events in a time-series with random interval between (heart beats) with Turing.jl](https://discourse.julialang.org/t/modelling-events-in-a-time-series-with-random-interval-between-heart-beats-with-turing-jl/112653)

<div class="topic-metadata">

**Author:** [@JohsEnevoldsen](https://discourse.julialang.org/u/JohsEnevoldsen)\
**Replies:** 14\
**Last updated:** [May 13, 2024, 9:38pm UTC](https://discourse.julialang.org/t/modelling-events-in-a-time-series-with-random-interval-between-heart-beats-with-turing-jl/112653 "2024-05-13T21:38:59Z")

</div>

(Edit: here is copy-paste-able code for the problematic model: heartbeat\_question\_code.jl · GitHub) I’m trying to learn Turing.jl, and after a few simple models, I wanted to fit a more complex model, that I could not fi…

---

## [Use FiniteDiff.jl in Turing.jl](https://discourse.julialang.org/t/use-finitediff-jl-in-turing-jl/113816)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 20\
**Last updated:** [May 9, 2024, 8:44am UTC](https://discourse.julialang.org/t/use-finitediff-jl-in-turing-jl/113816 "2024-05-09T08:44:51Z")

</div>

Hello, I have a user-defined density which does not support automatic differentiation (the function gamma\_inv\_cdf in SpecialFunctions.jl does not support AD). Is there a support for finite difference calculation with F…

---

## [Turing Mixture Models with Dirichlet weightings](https://discourse.julialang.org/t/turing-mixture-models-with-dirichlet-weightings/112910)

<div class="topic-metadata">

**Author:** [@Sam\_P](https://discourse.julialang.org/u/Sam_P)\
**Replies:** 8\
**Last updated:** [April 25, 2024, 12:47am UTC](https://discourse.julialang.org/t/turing-mixture-models-with-dirichlet-weightings/112910 "2024-04-25T00:47:03Z")

</div>

Hi all - I’ve been trying to use the MixtureModel in Turing to sample from a multi-modal dataset, and generating the probability for each mode using the Dirichlet distributions. Yet somehow I’ve been getting an BoundsErr…

---

## [Copulas.jl + Turing.jl - numerical stability?](https://discourse.julialang.org/t/copulas-jl-turing-jl-numerical-stability/113243)

<div class="topic-metadata">

**Author:** [@Domenic\_Di\_Francesco](https://discourse.julialang.org/u/Domenic_Di_Francesco)\
**Replies:** 6\
**Last updated:** [April 19, 2024, 9:44pm UTC](https://discourse.julialang.org/t/copulas-jl-turing-jl-numerical-stability/113243 "2024-04-19T21:44:09Z")

</div>

Hi all, I am a big fan of both libraries, but when I try to include copulas in probabilistic (Turing) models, I often get errors related to quantities being out of bounds. I have included a simple example below. The be…

---

## [Any variational bayesian package that allows user defined custom distribution (getq in turing)](https://discourse.julialang.org/t/any-variational-bayesian-package-that-allows-user-defined-custom-distribution-getq-in-turing/112946)

<div class="topic-metadata">

**Author:** [@swsw](https://discourse.julialang.org/u/swsw)\
**Replies:** 1\
**Last updated:** [April 17, 2024, 8:13am UTC](https://discourse.julialang.org/t/any-variational-bayesian-package-that-allows-user-defined-custom-distribution-getq-in-turing/112946 "2024-04-17T08:13:02Z")

</div>

Hi all, I wondered if there’s any package that allow the user to specify any kind of distribution as q(Z). I think in https://turinglang.org/v0.30/tutorials/09-variational-inference/ it is mentioned that by default the…

---

## [Drawing variables from truncated normal with mean as another variable](https://discourse.julialang.org/t/drawing-variables-from-truncated-normal-with-mean-as-another-variable/113044)

<div class="topic-metadata">

**Author:** [@gonzalo](https://discourse.julialang.org/u/gonzalo)\
**Replies:** 2\
**Last updated:** [April 17, 2024, 4:40am UTC](https://discourse.julialang.org/t/drawing-variables-from-truncated-normal-with-mean-as-another-variable/113044 "2024-04-17T04:40:56Z")

</div>

Hi All, I want to drawing random variables from truncated normal with mean as another variable. However it didn’t work and I got the following wrong message. Is there anyone who can help me with it? Gonzalo using Turi…

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

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