# MAP optimization in Turing with LBFGS doesn't move at all

**URL:** <https://discourse.julialang.org/t/map-optimization-in-turing-with-lbfgs-doesnt-move-at-all/118431>\
**Category:** Probabilistic Programming\
**Tags:** optimization, turing, autodiff\
**Created:** [August 20, 2024, 10:10pm UTC](https://discourse.julialang.org/t/map-optimization-in-turing-with-lbfgs-doesnt-move-at-all/118431 "2024-08-20T22:10:32Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [August 23, 2024, 2:39pm UTC](https://discourse.julialang.org/t/map-optimization-in-turing-with-lbfgs-doesnt-move-at-all/118431/21 "2024-08-23T14:39:14Z")

</div>

> [@dpo](#):
>
> I recommend the one in [PRIMA.jl](https://github.com/libprima/prima.jl) where bugs in the original BOBYQA have been fixed.

oh interesting. I’m using NLopt through the Turing interface that uses Optimization.jl underneath.

> [@mcreel](#):
>
> I was also wondering why the random seed matters.

I’m tearing my hair out a little… Yes it’s taking a sample of my data and then fitting the model. So the sample could change for sure. But then if I get a “good” seed it seems like it doesn’t matter which size sample of data I use, and since the size means different random numbers are used anyway, it’s just confusing as heck… I guess random numbers can be that way. I’ll look into it again.

---

<div class="post-metadata">

**Author:** ![dpo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpo/32/3335_2.png) [@dpo](https://discourse.julialang.org/u/dpo)\
**Post date:** [August 23, 2024, 2:48pm UTC](https://discourse.julialang.org/t/map-optimization-in-turing-with-lbfgs-doesnt-move-at-all/118431/22 "2024-08-23T14:48:22Z")

</div>

If your problem is stochastic, all bets are off. Those methods aren’t made for such problems at all.

---

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [August 23, 2024, 3:31pm UTC](https://discourse.julialang.org/t/map-optimization-in-turing-with-lbfgs-doesnt-move-at-all/118431/23 "2024-08-23T15:31:48Z")

</div>

No it’s not stochastic (in the sense that the objective changes during the optimization). It’s just that I take my big sample of data, subsample it, and then try to fit the model. So if the seed matters and the optimization method is deterministic, then it suggests the sample it chooses determines whether the problem can be solved by the optimizer or if the optimizer gives up at the initial conditions. This just makes everything harder to figure out 😅

[Previous page](https://discourse.julialang.org/t/map-optimization-in-turing-with-lbfgs-doesnt-move-at-all/118431.md?page=1)
