# Initialization

**URL:** <https://discourse.mc-stan.org/t/initialization/33102>\
**Category:** CmdStan\
**Tags:** cmdstanr, fitting-issues\
**Created:** [October 19, 2023, 8:52pm UTC](https://discourse.mc-stan.org/t/initialization/33102 "2023-10-19T20:52:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpfiffer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/cpfiffer/32/15280_2.png) [@cpfiffer](https://discourse.mc-stan.org/u/cpfiffer)\
**Post date:** [October 19, 2023, 8:52pm UTC](https://discourse.mc-stan.org/t/initialization/33102/1 "2023-10-19T20:52:58Z")

</div>

Hey there!

I’m wondering if people could help me out a bit with a problem we’re having. Essentially we can sample our model quite well, usually after the first 5-10 iterations. There are a few numerical issues at the start due to our initialization point being a little clumsy.

The thing we want to do is basically to start the MLE/MAP from an interior point in sampling. We have a _ton_ of parameters so we can’t do this `init = list(alpha = 0.5, beta=2.0)` syntax that doesn’t seem to scale well.

Does anyone have a good technique for extracting a ready-to-go initialization list from a chain or an MLE/MAP result?

In general I find that it’s frustrating to take anything that is an output from Stan and use it as an input elsewhere, in large part because the conventions between input and output differ.

For example, an initialization for vector variables might look like

```plaintext
init = list(means = c(5, 10, 122))

```

whereas the output (when converted using `posterior` or `chain$draws(format="list")`) ends up being something like

```plaintext
list (
  `means[1]` = 5,
  `means[2]` = 6,
  `means[3]` = 15,
)

```

Not sure how many people deal with something similar. Any advice is appreciated!

---

<div class="post-metadata">

**Author:** ![WardBrian](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wardbrian/32/12078_2.png) [@WardBrian](https://discourse.mc-stan.org/u/WardBrian)\
**Post date:** [October 19, 2023, 11:29pm UTC](https://discourse.mc-stan.org/t/initialization/33102/2 "2023-10-19T23:29:30Z")

</div>

This is possible in cmdstanpy, I believe there is an ongoing discussion for cmdstanr here: [Ability to convert a draw of parameters into something compatible with the init arg · Issue #776 · stan-dev/cmdstanr · GitHub](https://github.com/stan-dev/cmdstanr/issues/776)
