# How to initialize ADVI

**URL:** <https://discourse.pymc.io/t/how-to-initialize-advi/12693>\
**Category:** v5\
**Created:** [August 8, 2023, 11:34pm UTC](https://discourse.pymc.io/t/how-to-initialize-advi/12693 "2023-08-08T23:34:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dushyant](https://avatars.discourse-cdn.com/v4/letter/d/e480ec/32.png) [@dushyant](https://discourse.pymc.io/u/dushyant)\
**Post date:** [August 8, 2023, 11:34pm UTC](https://discourse.pymc.io/t/how-to-initialize-advi/12693/1 "2023-08-08T23:34:31Z")

</div>

How can I set the starting point of ADVI for M1 using the meanfield approximation from M2? I saw that pm.ADVI has two start arguments but couldn’t understand how to populate them.

```
with M2:
    
  inference = pm.ADVI(random_seed=seed)

  approx = pm.fit(n= 10000, random_seed=seed, method=inference, obj_optimizer=adam(learning_rate=0.05,decay_iter=4000))
  idata = approx.sample(2000,random_seed=seed) 

with M1:
  inference = pm.ADVI(random_seed=seed, start=??)

  approx = pm.fit(n= 10000, random_seed=seed, method=inference, obj_optimizer=adam(learning_rate=0.05,decay_iter=4000))
  idata_servicer = approx.sample(2000,random_seed=seed)  

```

I looked at [How to choose initial values for MeanField sigma, and transform rho-\>sigma?](https://discourse.pymc.io/t/how-to-choose-initial-values-for-meanfield-sigma-and-transform-rho-sigma/6343), but the solution there did not work. Any suggestions @ricardoV94 @jessegrabowski?

---

<div class="post-metadata">

**Author:** ![cluhmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/cluhmann/32/3083_2.png) [@cluhmann](https://discourse.pymc.io/u/cluhmann)\
**Post date:** [August 9, 2023, 11:41am UTC](https://discourse.pymc.io/t/how-to-initialize-advi/12693/2 "2023-08-09T11:41:31Z")

</div>

I think @fonnesbeck uses VI on Mac. Maybe he has some suggestions?

---

<div class="post-metadata">

**Author:** ![fonnesbeck](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/fonnesbeck/32/13_2.png) [@fonnesbeck](https://discourse.pymc.io/u/fonnesbeck)\
**Post date:** [August 9, 2023, 1:25pm UTC](https://discourse.pymc.io/t/how-to-initialize-advi/12693/3 "2023-08-09T13:25:46Z")

</div>

The `start` argument expects a dict of starting values for the random variables in the model. So if you had a linear regression model it would be something like: `start={"intercept": 0, "slope": 1, "noise": 3}`. So if you are populating it with the results from another model, you could put the posterior means in there, for example.
