# 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:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [August 22, 2024, 8:11am UTC](https://discourse.julialang.org/t/map-optimization-in-turing-with-lbfgs-doesnt-move-at-all/118431/14 "2024-08-22T08:11:24Z")

</div>

Not saying you’re as stupid as I am, but have you checked for NaNs in the full data set? I spent about 3 hours the other day working out what went wrong in an optimisation problem that worked when using some of my data but not all of it and it turned out there was an unexpected Nan in the data (stock prices, so a NaN value really didn’t make any sense at all…)

I guess this isn’t the case as you seem to be able to solve the problem on the full data with some optimizers, but thought I’d mention it anyway.

And to throw something else into the mix, this old discussion about potential ways of catching NaNs as they appear:

> [@NaN Detector](https://discourse.julialang.org/t/nan-detector/55024):
>
> I’m trying to find my NaN generator. I think it is due to an uninitialized input variable without proper protection in the code. I know the debugger doesn’t have a nan break and it is very difficult for me to get to the spot. My thought was, can I somehow override the base./ function call to do a 0.0/0.0 check and alert me with a stack trace of the calling function or just throw an error and die right there with a stack trace. I thought I could just override Base./ at the top level, but do I…

---

_[View the full topic](https://discourse.julialang.org/t/map-optimization-in-turing-with-lbfgs-doesnt-move-at-all/118431)._
