JuliaGaussianProcesses / JuliaGaussianProcesses/KernelFunctions.jl

Perhaps avoid validating input dims on AbstractVector{<:AbstractVector{<:Real}}

Open
#512 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
275
Forks
41
PR merge metrics
No merged PRs in 30d

Description

I would suggest either changing this, or perhaps better, skipping it all together.
https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/blob/ef6d4591b36194fca069d8bc7ae8c1e2ee288080/src/utils.jl#L194

I'm developing kernels that work on pairs of Vector{Float64}, where the kernel essentially sums over all pairwise distances in x and y. For this kernel, the check above does not really make sense, and indeed passes if I construct the kernel matrix like this:

K = kernelmatrix(kernel, x,x)

However it fails if I instead do

K = kernelmatrix(kernel, x,y)

unless length(first(x))==length(first(y)). I realise that I can just create my own type essentially wrapping Vector{Vector{Float64}}, but that seems like unnecessary work, especially since the kernel machinery works beautifully as it is, as long as the inputs pass the validation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/utils.jl line 194 and inspect the validation reached by kernelmatrix(kernel, x, y). Reproduce the difference between kernelmatrix(kernel, x, x) and kernelmatrix(kernel, x, y) with Vector{Vector{Float64}} inputs, then determine whether differing inner lengths should be accepted for kernels based on pairwise distances. Done means the intended validation behavior is implemented and covered for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.