Skip to content

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

Description

@grero

I would suggest either changing this, or perhaps better, skipping it all together.

dim(x::AbstractVector{<:AbstractVector{<:Real}}) = length(first(x))

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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