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

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?

┌ 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

@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)
1 Like

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

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