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

How to derive the closed form for M, S, and C in squash_sin(m, s, max_action=None) #12

Closed
thaipduong opened this issue Oct 11, 2018 · 5 comments

Comments

@thaipduong
Copy link

Hi guys,
I'm trying to analytically derive the closed forms for M, S and C used in squash_sin function. Deisenroth's thesis only points to some integrations in Appendix A.1 but I don't how he came up with the form used in the code.
Do you happen to know how to derive the forms? Any pointers would be much appreciated.

Thanks.

@thaipduong
Copy link
Author

Never mind. I figured it out. Thanks.

@hejia-zhang
Copy link

hejia-zhang commented Nov 22, 2018

Hi @thaipduong, could you give me some hints on it? I am also trying to figure this out while have no clues yet.

@mdbenito
Copy link

Consider two gaussians X_i and X_j and their sines Y_i = sin X_i and Y_j = sin X_j. You want to compute the covariance E[(Y_i - EY_i) (Y_j - EY_j]. After expanding the product and simplifying a bit, one of the terms is E[Y_i Y_j]. This is the product of two sines so you can use the formula expressing it as a a difference of cosines. Use linearity and after some arithmetic you have entry ij in the covariance matrix, already looking similar to the code. The final part is to vectorise that. For this note what the convention in Tensorflow or numpy is when a column vector is added to a row vector and you are almost done.

Hope that helps!

@thaipduong
Copy link
Author

@hjzh4 , I found my notes on this here: https://drive.google.com/file/d/1MqZMkRM6vkLJIOOhe8gXFddpMflLJvB2/view?usp=sharing
It's the same as what @mdbenito mentioned above. Hope it helps.

@hejia-zhang
Copy link

@thaipduong @mdbenito , thanks a lot guys! I just figured it out!
could you also take a look at issue #15 I think there is something missed in the formula for computing C

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