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

interested in sgd for complex function not in the available families; sgd for gmm not implemented? #109

Closed
donboyd5 opened this issue May 26, 2022 · 3 comments

Comments

@donboyd5
Copy link

Hi. I am not an expert so I may be misinterpreting things.

I am interested in using sgd to minimize a complex function that does not fit into available families. If I understand it properly, I need to provide that function (and, ideally, its gradient) to sgd.

As I understand it, (a) you do not recommend this because it will be slowed down by R code (#103), but (b) if I were to try it, I should base it on the method of moments example.

However, that example appears not to be implemented. When I tried to run it, the output was:

Error in predict.sgd(out, x, type = "response") : 'model' not supported

Looking at the predict.sgd code (lines 24-26) this appears to be because the gmm method is not supported, at least not in the predict.sgd function.

However, looking at the sgd code (lines 411-471), sgd does appear to try to support gmm, with finite differences if no gradient function is provided.

Would you mind confirming whether I might be able to use sgd to minimize an arbitrary function, and if so how?

Many thanks.

@ptoulis
Copy link
Contributor

ptoulis commented May 29, 2022

Hi @donboyd5
I wouldn't recommend using sgd for arbitrary functions.
For one, if you know the function/gradient then writing the sgd code is straightforward.
Second, none of the 'machinery' we have for glms is easily generalizable, especially the implicit updates.

I would be curious if @dustinvtran has any more thoughts.

@dustinvtran
Copy link
Member

Thanks for the cc.

I believe the gmm implementation in sgd was experimental and I didn't get it to work very well. Finite differences is not a useful approach these days in any case as autodiff is readily available.

@donboyd5
Copy link
Author

@ptoulis, @dustinvtran, thank you both!

Don

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