Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models using boost::math::tools::schroeder_iterate can get stuck #108

Open
jonlachmann opened this issue Apr 21, 2021 · 4 comments
Open

Comments

@jonlachmann
Copy link

Hi, I am building a package that is using sgd. When doing tests I sometimes encountered models that got stuck in the sgd C++ part for no particular reason, crashing R in the end. I did address sanitizing, but everything checked out. Then I investigated where it got stuck, and it was while running the boost::math::tools::schroeder_iterate function for the update in implicit_sgd.h (rows 79 and 110). I made a fork at https://github.com/jonlachmann/sgd fixing this by just setting the max iterations for boost::math::tools::schroeder_iterate to 1000. I have no idea if this is a reasonable value, but it solves the problem.

Do you want me to create a pull request, or is this something that might need further looking into?

@AlbertRapp
Copy link

Had the same problem. Installed your fork and now R doesn't crash anymore while using sgd. Thanks.

@ptoulis
Copy link
Contributor

ptoulis commented May 29, 2022

Hey @jonlachmann Thanks for creating the fork. Appreciate it.

Sounds like a weird numerical issue.
Do you have a data/code example to reproduce it by any chance?

@jonlachmann
Copy link
Author

Hi! This was during the more intense part of writing my thesis. I do not really remember how I managed to get this to happen, and I ended up coding a more basic SGD from scratch to demonstrate the ideas in the thesis.

I was using different stochastic algorithms in a bayesian model selection setting, so I ran many thousand models, which some of the time gave strange errors that were edge cases of various implementations. Perhaps @AlbertRapp has something that is reproducible?

Anyway, I could try to see if I have any code that relates to this, but I am not too optimistic as the thesis period was very hectic. If you want to apply my fix in your codebase I would be happy to provide a PR.

@ptoulis
Copy link
Contributor

ptoulis commented Jun 1, 2022

Sure, that would be great! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants