Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RationalQuadraticKernel and GammaRationalQuadraticKernel implementations #170

Closed
molet opened this issue Sep 21, 2020 · 2 comments
Closed

Comments

@molet
Copy link
Contributor

molet commented Sep 21, 2020

I would be interested if there is a particular reason of implementing RationalQuadraticKernel as:

κ(x,y)=(1+||xy||²/α)^(-α)

instead of:

κ(x,y)=(1+||xy||²/(2α))^(-α)

Most of the implementations I have seen are using the latter form and I'm wondering if KernelFunctions.jl could use it as well in order to make comparisons easier.

Also, this is the docstring of GammaRationalQuadraticKernel:

"""
`GammaRationalQuadraticKernel([ρ=1.0[,α=2.0[,γ=2.0]]])`
The Gamma-rational-quadratic kernel is an isotropic Mercer kernel given by the formula:

    κ(x,y)=(1+ρ^(2γ)||x−y||^(2γ)/α)^(-α)

where `α` is a shape parameter of the Euclidean distance and `γ` is another shape parameter.
"""

However, there is no such variable ρ that can be defined in the actual constructor:

struct GammaRationalQuadraticKernel{Tα<:Real, Tγ<:Real} <: SimpleKernel
    α::Vector{Tα}
    γ::Vector{Tγ}
    function GammaRationalQuadraticKernel(;alpha::Tα=2.0, gamma::Tγ=2.0, α::Tα=alpha, γ::Tγ=gamma) where {Tα<:Real, Tγ<:Real}
        @check_args(GammaRationalQuadraticKernel, α, α > one(Tα), "α > 1")
        @check_args(GammaRationalQuadraticKernel, γ, γ >= one(Tγ), "γ >= 1")
        return new{Tα, Tγ}([α], [γ])
    end
end

It might have been forgotten in the implementation or - if skipping it was intentional - it would be nice to update the docstring.

@willtebbutt
Copy link
Member

Most of the implementations I have seen are using the latter form and I'm wondering if KernelFunctions.jl could use it as well in order to make comparisons easier.

This probably relates to #158 -- I guess I just missed this when I was reviewing everything.

@willtebbutt willtebbutt mentioned this issue Sep 21, 2020
2 tasks
@devmotion
Copy link
Member

This is fixed now: the definition of RationalQuadraticKernel was changed as suggested above and the docstring of GammaRationalQuadraticKernel (renamed to GammaRationalKernel) was fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants