# \[Turing.jl\] Warning: The current proposal will be rejected due to numerical error(s)

**URL:** https://discourse.julialang.org/t/turing-jl-warning-the-current-proposal-will-be-rejected-due-to-numerical-error-s/72396
**Category:** Statistics
**Tags:** turing
**Created:** [December 1, 2021, 6:45pm UTC](https://discourse.julialang.org/t/turing-jl-warning-the-current-proposal-will-be-rejected-due-to-numerical-error-s/72396 "2021-12-01T18:45:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![weiqi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/weiqi/32/22148_2.png) [@weiqi](https://discourse.julialang.org/u/weiqi)
#### Post date: [December 1, 2021, 6:45pm UTC](https://discourse.julialang.org/t/turing-jl-warning-the-current-proposal-will-be-rejected-due-to-numerical-error-s/72396/1 "2021-12-01T18:45:35Z")

</div>

I am running MCMC with Turing.jl for an ODE model. The model contains about 111 parameters. I have noticed that the sampler constantly gives the following warning due to the truncated distribution for prior.

Wondering if I need to worry about those warnings? Or it is just slowing down the sampling, and won’t affect the results?

```nohighlight
┌ Info: Found initial step size
└ ϵ = 0.2
┌ Warning: The current proposal will be rejected due to numerical error(s).
│ isfinite.((θ, r, ℓπ, ℓκ)) = (true, false, false, false)
└ @ AdvancedHMC ~/.julia/packages/AdvancedHMC/HQHnm/src/hamiltonian.jl:47
┌ Warning: The current proposal will be rejected due to numerical error(s).
│ isfinite.((θ, r, ℓπ, ℓκ)) = (true, false, false, false)
└ @ AdvancedHMC ~/.julia/packages/AdvancedHMC/HQHnm/src/hamiltonian.jl:47

```

Below are my model and chain

```nohighlight
@model function surrogate_model(data_vec)

    kf ~ filldist(truncated(Normal(), -3.0, 3.0), n_params)

    kf_uf = kf .* uf

    for i_exp = 1:used_exp

        scaler_mean = l_scaler_mean[i_exp]
        scaler_scale = l_scaler_scale[i_exp]

        kf_ = (kf_uf .- scaler_mean[1:n_params]) ./ scaler_scale[1:n_params]
        ts_ = (ts .- scaler_mean[n_params+1]) ./ scaler_scale[n_params+1]

        Gp = l_params_net[1](kf_)
        Hx = l_coord_net[1](ts_')

        pred = reshape(Gp, :, n_out)' * Hx

        pred_ = pred .* scaler_scale[end-n_out+1:end] .+ scaler_mean[end-n_out+1:end]

        data_vec[i_exp, :] ~ MvNormal(vec(pred_), obs_sigma_vec)

    end

end

chain = sample(model, NUTS(n_warmup, 0.65), n_sample)

```

---

<div class="post-metadata">

### Author: ![markmbaum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/markmbaum/32/32745_2.png) [@markmbaum](https://discourse.julialang.org/u/markmbaum)
#### Post date: [November 10, 2022, 4:38pm UTC](https://discourse.julialang.org/t/turing-jl-warning-the-current-proposal-will-be-rejected-due-to-numerical-error-s/72396/2 "2022-11-10T16:38:28Z")

</div>

I’m doing some experimentation with Turing.jl and wondering the same thing. Did you figure it out?

---

<div class="post-metadata">

### Author: ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)
#### Post date: [November 10, 2022, 4:43pm UTC](https://discourse.julialang.org/t/turing-jl-warning-the-current-proposal-will-be-rejected-due-to-numerical-error-s/72396/3 "2022-11-10T16:43:26Z")

</div>

A few warnings at the beginning of the sampling process is usually OK. What is the ratio of warnings to samples in your model?
