JuliaGaussianProcesses / Stheno.jl

Probabilistic Programming with Gaussian processes in Julia
Other
338 stars 26 forks source link

Can anyone provide an example of using Stheno for multi-input GP regression? #237

Closed parikshit-pareek closed 1 year ago

parikshit-pareek commented 1 year ago

Need to perform GP regression for a function y = g(x) where x is a vector of say 'D' length.

willtebbutt commented 1 year ago

Hi @parikshit-pareek , thanks for opening this issue!

Have you seen this section of the docs, or the input-types docs in KernelFunctions?

parikshit-pareek commented 1 year ago

@willtebbutt I did saw and found x =ColVecs(X) to use. However, not sure how to provide different length scales to Kernels i.e. ARD kernels. So, an example of large dimensional learning would be of help.

In case such an example not specifically available, I am happy to close the issue.

willtebbutt commented 1 year ago

Ah I see. Yes, that's definitely possible.

The best option is the ARDTransform defined in KernelFunctions. You would do something like

inverse_length_scales = rand(5)
k = SEKernel() ∘ ARDTransform(inverse_length_scales)
x = ColVecs(randn(5, 13))
kernelmatrix(k, x)

and then plug that into your Stheno.jl model.

willtebbutt commented 1 year ago

Would it have been helpful to have this advice in an FAQ section or something?

willtebbutt commented 1 year ago

Also, it turns out that with_lengthscale generalises to vectors of lengthscales (I had just forgotten that it's a thing!):

length_scales = rand(5)
k = with_lengthscale(SEKernel(), length_scales)
willtebbutt commented 1 year ago

@parikshit-pareek the docs in KernelFunctions have been improved to make it more obvious how this would be done. Could you please let me know if you also find them sufficiently clear?

parikshit-pareek commented 1 year ago

@willtebbutt Yes, its clear now.