You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be desirable to have methods for dot and matrix multiplication to form linear combinations of vectors of GPs? This could make it much easier to programmatically construct composite GPs for things like spatial factor analysis. MWE is below; I can turn this into a PR if wanted...
using Stheno, AbstractGPs
import LinearAlgebra: dot
import Base:*dot(x::Vector{T}, ff::Vector{G}) where {T<:Number,G<:AbstractGPs.AbstractGP} =sum(x .* ff)
*(A::Matrix{T}, ff::Vector{G}) where {T<:Number,G<:AbstractGPs.AbstractGP} = Stheno.cross([dot(A[i, :], ff) for i in1:size(A, 1)])
f1 =@gppplet
ff = [GP(SEKernel()) for _ in1:2]
a = [0.5, 2.0]
f3 =dot(a, ff)
end
f2 =@gppplet
ff = [GP(SEKernel()) for _ in1:2]
A = [1.02.0; 3.04.0]
f3 = A * ff
end
The text was updated successfully, but these errors were encountered:
This seems like a good idea. I think your proposal for the definition of dot is correct, but I think the multiplication one ought to just produce a vector of GPs, rather than a single GP.
Either way, very happy to review a PR that implements this stuff.
Ok, I wasn't totally sure about using cross for the matrix-multiplication case myself. The use case I'm picturing is something like the second model in the readme (with one latent GP and two outputs). I'd like to be able to do something like this:
f =@gppplet# Define a smooth latent process that we wish to infer.
f =GP(SEKernel())
# Define the two noise processes described.
g = x->sin.(x) .-5.0.+sqrt.(abs.(x))
noise1 =sqrt(1e-2) *GP(WhiteKernel()) + g
noise2 =sqrt(1e-1) *GP(3.5, WhiteKernel())
# Define the processes that we get to observe.# These two lines are from the example# y1 = f + noise1# y2 = f + noise2# These two lines are supposed to do the same thing, conceptually
A = [110; 101]
y = A * [f, noise1, noise2]
end;
The goal would be making it easier to define models with arbitrary numbers of latent and observed processes, without having to manually define y1, y2, ...yn.
Would it be desirable to have methods for
dot
and matrix multiplication to form linear combinations of vectors of GPs? This could make it much easier to programmatically construct composite GPs for things like spatial factor analysis. MWE is below; I can turn this into a PR if wanted...The text was updated successfully, but these errors were encountered: