# Frequently Asked Questions

**URL:** <https://discourse.pymc.io/t/frequently-asked-questions/74>\
**Category:** Questions\
**Created:** [June 14, 2017, 2:25pm UTC](https://discourse.pymc.io/t/frequently-asked-questions/74 "2017-06-14T14:25:45Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [January 13, 2018, 1:41pm UTC](https://discourse.pymc.io/t/frequently-asked-questions/74/6 "2018-01-13T13:41:31Z")

</div>

- `NaN occurred in optimization` at the first iteration in VI (i.e., seeing something like `0%| | 0/5000 [00:00<?, ?it/s]`)

Check the initial approximation parameters: `approx.approx.params[0].eval()`. If it returns nan, that is what causing the error.

Setting the value manually to zero could solve this. Below is an example if you are doing ADVI:

```python
mu_approx = approx.approx.params[0]
rho_approx = approx.approx.params[1]

mu_approx.set_value(np.zeros(mu_approx.eval().shape))
rho_approx.set_value(np.zeros(rho_approx.eval().shape))

```

---

_[View the full topic](https://discourse.pymc.io/t/frequently-asked-questions/74)._
