# There were 6 divergences after tuning. Increase \`target\_accept\` or reparameterize

**URL:** <https://discourse.pymc.io/t/there-were-6-divergences-after-tuning-increase-target-accept-or-reparameterize/6458>\
**Category:** Questions\
**Created:** [December 19, 2020, 6:38am UTC](https://discourse.pymc.io/t/there-were-6-divergences-after-tuning-increase-target-accept-or-reparameterize/6458 "2020-12-19T06:38:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayao](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@ayao](https://discourse.pymc.io/u/ayao)\
**Post date:** [December 19, 2020, 6:38am UTC](https://discourse.pymc.io/t/there-were-6-divergences-after-tuning-increase-target-accept-or-reparameterize/6458/1 "2020-12-19T06:38:11Z")

</div>

with pm.Model() as model\_5\_7:  
a = pm.Normal(‘a’, mu=10, sd=100)  
bn = pm.Normal(‘bn’, mu=0, sd=1, shape=2)  
sigma = pm.Uniform(‘sigma’, lower=0, upper=1)  
mu = pm.Deterministic(‘mu’, a + bn[0] \* dcc[‘neocortex.perc’] + bn[1] \* dcc[‘log\_mass’])  
kcal = pm.Normal(‘kcal’, mu=mu, sd=sigma, observed=dcc[‘kcal.per.g’])  
trace\_5\_7 = pm.sample(1000, tune=1000)

[Auto-assigning NUTS sampler…  
Initializing NUTS using jitter+adapt\_diag…  
Multiprocess sampling (2 chains in 2 jobs)  
NUTS: [sigma, bn, a]  
Sampling 2 chains: 100%|███████████████████████████████████████████████████████| 4000/4000 [00:20\<00:00, 198.18draws/s]  
There were 6 divergences after tuning. Increase `target_accept` or reparameterize.  
There was 1 divergence after tuning. Increase `target_accept` or reparameterize.]

the result tell me " Increase `target_accept` or reparameterize.",what shold I do in my model? thank you !

---

<div class="post-metadata">

**Author:** ![luisroque](https://avatars.discourse-cdn.com/v4/letter/l/7c8e57/32.png) [@luisroque](https://discourse.pymc.io/u/luisroque)\
**Post date:** [December 19, 2020, 5:31pm UTC](https://discourse.pymc.io/t/there-were-6-divergences-after-tuning-increase-target-accept-or-reparameterize/6458/2 "2020-12-19T17:31:31Z")

</div>

Hi, you could use more informative priors. For example, reducing the sd in the normal distribution of `a` and using a HalfCauchy or HalfNormal instead of a uniform distribution for `sigma`.

Hope it helps!

---

<div class="post-metadata">

**Author:** ![ayao](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@ayao](https://discourse.pymc.io/u/ayao)\
**Post date:** [December 20, 2020, 12:49am UTC](https://discourse.pymc.io/t/there-were-6-divergences-after-tuning-increase-target-accept-or-reparameterize/6458/4 "2020-12-20T00:49:56Z")

</div>

> [@luisroque](#):
>
> Hi, you could use more informative priors. For example, reducing the sd in the normal distribution of `a` and using a HalfCauchy or HalfNormal instead of a uniform distribution for `sigma` .
> 
> Hope it helps!

Thanks for your advice, it’s divergence due to the bad priors? I am the newer to pymc , studying the text " Statistical-Rethinking"。 I try run the pymc code ，but some meet divergence warning。

---

<div class="post-metadata">

**Author:** ![luisroque](https://avatars.discourse-cdn.com/v4/letter/l/7c8e57/32.png) [@luisroque](https://discourse.pymc.io/u/luisroque)\
**Post date:** [December 20, 2020, 3:47pm UTC](https://discourse.pymc.io/t/there-were-6-divergences-after-tuning-increase-target-accept-or-reparameterize/6458/5 "2020-12-20T15:47:35Z")

</div>

I would say it is. You can also test if increasing the number of tuning steps helps (you are currently using 1000, you can increase to 3000 for instance).

---

<div class="post-metadata">

**Author:** ![ayao](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@ayao](https://discourse.pymc.io/u/ayao)\
**Post date:** [December 21, 2020, 12:19am UTC](https://discourse.pymc.io/t/there-were-6-divergences-after-tuning-increase-target-accept-or-reparameterize/6458/6 "2020-12-21T00:19:24Z")

</div>

thank you!~

---

<div class="post-metadata">

**Author:** ![vanko](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/vanko/32/4509_2.png) [@vanko](https://discourse.pymc.io/u/vanko)\
**Post date:** [August 19, 2021, 2:25pm UTC](https://discourse.pymc.io/t/there-were-6-divergences-after-tuning-increase-target-accept-or-reparameterize/6458/7 "2021-08-19T14:25:37Z")

</div>

I had the same issue.  
I fixed it with changing slope bn to HalfNormal and increasing sd

bn = pm.Normal(‘bn’, mu=0, sd=1, shape=2)

You can change sd to 10 first then if it still not working - move to HalfNormal
