Closed theogf closed 1 year ago
Here is a MWE:
julia> v = ones(2); julia> rbf = rand(2); julia> cos = rand(2); julia> spectral_mixture_kernel(v, rbf', cos') Sum of 2 kernels: Product of 2 kernels: Squared Exponential Kernel (metric = Distances.Euclidean(0.0)) - Linear transform (size(A) = (1, 1)) - σ² = 1.0 Cosine Kernel (metric = Distances.Euclidean(0.0)) - Linear transform (size(A) = (1, 1)) Product of 2 kernels: Squared Exponential Kernel (metric = Distances.Euclidean(0.0)) - Linear transform (size(A) = (1, 1)) - σ² = 1.0 Cosine Kernel (metric = Distances.Euclidean(0.0)) - Linear transform (size(A) = (1, 1)) julia> @inferred spectral_mixture_kernel(v, rbf', cos') ERROR: return type KernelSum{Tuple{KernelProduct{Tuple{ScaledKernel{TransformedKernel{SqExponentialKernel{Distances.Euclidean}, LinearTransform{LinearAlgebra.Adjoint{Float64, SubArray{Float64, 1, LinearAlgebra.Adjoint{Float64, Vector{Float64}}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}}}, Float64}, TransformedKernel{CosineKernel{Distances.Euclidean}, LinearTransform{LinearAlgebra.Adjoint{Float64, SubArray{Float64, 1, LinearAlgebra.Adjoint{Float64, Vector{Float64}}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}}}}}, KernelProduct{Tuple{ScaledKernel{TransformedKernel{SqExponentialKernel{Distances.Euclidean}, LinearTransform{LinearAlgebra.Adjoint{Float64, SubArray{Float64, 1, LinearAlgebra.Adjoint{Float64, Vector{Float64}}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}}}, Float64}, TransformedKernel{CosineKernel{Distances.Euclidean}, LinearTransform{LinearAlgebra.Adjoint{Float64, SubArray{Float64, 1, LinearAlgebra.Adjoint{Float64, Vector{Float64}}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}}}}}}} does not match inferred return type Any Stacktrace: [1] error(s::String) @ Base ./error.jl:35 [2] top-level scope @ REPL[56]:1
Now that I think about it, it makes sense. There is no way the size of the mixture can be inferred unless we would pass some static vectors or tuples.
Here is a MWE: