Skip to content

spectral_mixture_kernel constructor is not type-stable #490

Closed
@theogf

Description

@theogf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions