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

Kernel vs GP composition #182

Open
kaandocal opened this issue May 27, 2021 · 6 comments
Open

Kernel vs GP composition #182

kaandocal opened this issue May 27, 2021 · 6 comments

Comments

@kaandocal
Copy link

Hi there, I am trying to get into Stheno a little but I'm having a little trouble figuring out whether there are any notable differences between some transformations applied to GPs vs. kernels and mean functions. Examples are stretch vs. KernelFunctions.ScaleTransform, or GP + GP vs. Kernel + Kernel and Mean + Mean (I assume this would be useful when combined different likelihood functions). Would there be any loss eg. in defining stretch to work via input transforms on the kernel and mean functions?

@willtebbutt
Copy link
Member

Hi! Glad to hear you're trying the two approaches out.

There's no issue per-se in taking either approach. Certainly, you can recover the process that you get by writing GP + GP using Kernel + Kernel and Mean + Mean, for example. The distinction is whether or not you're able to decompose the posterior into its components.

For example, writing something like

f = @gppp begin
    f1 = GP(SEKernel())
    f2 = GP(Matern12Kernel())
    f3 = f1 + f2
end

lets you write things like

f_post = posterior(f(GPPPInput(:f3, x), y)
f_post(GPPPInput(:f2, x))

to get the posterior over f2 given y at some locations x, and you could do the same for f1. If you write Kernel + Kernel, it's not straightforward to get at anything other than the equivalent of the posterior over f3.

Does this help?

@kaandocal
Copy link
Author

Thanks a lot, that's very helpful! In any case being able to add GPs is great functionality. How about stretch?

@willtebbutt
Copy link
Member

It's a similar story with stretch :)

f = @gppp begin
    f1 = GP(SEKernel())
    f2 = stretch(f1, 0.5)
end

f2 should be equivalent to

GP(SEKernel()  ScaleTransform(0.5))

(I might be off by a constant factor)

It's probably easier to get at f1 via f than it would be to get at it manually via the GP, if for some reason that's what you wanted to do, but it's less of a clear win than in the case of addition of processes.

@kaandocal
Copy link
Author

That makes sense. I too am less convinced by this example, but thanks very much for the clarification!

@willtebbutt
Copy link
Member

Haha glad you agree.

I'm keen to get differentiation / integration working in addition to addition etc, but haven't had the time. These are the kinds of things that I think would also be very convincing, and potentialy have quite a lot of utility.

@kaandocal
Copy link
Author

These would definitely be great ideas and would look great in any demo.

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

2 participants