Skip to content

Type instability for kernelmatrix with KernelProduct #485

Closed
@theogf

Description

@theogf

Similar to #458 there seems to be an issue with product of kernels.
Basic cases like SqExponentialKernel() * SqExponentialKernel() work fine but more nested kernels have issues.
In particular, this does not seem to work:

using Test, KernelFunctions
x = rand(10, 2);
k = RBFKernel() * ((LinearKernel() + 1.0 * CosineKernel() * RBFKernel())  SelectTransform(1));
@inferred kernelmatrix(k, RowVecs(x))
ERROR: return type Matrix{Float64} does not match inferred return type Any
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] top-level scope
   @ REPL[31]:1

I will try to make a PR similar to #459 to solve the issue.

Metadata

Metadata

Assignees

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