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

Add InverseMultiQuadricKernel #396

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

devmotion
Copy link
Member

This PR adds the inverse multiquadric kernel

$$k(x, x'; alpha, c) = (c + d(x, x')^2)^(- alpha)$$

with parameters alpha, c > 0.

In recent years, in particular in the ML community (possibly due to https://arxiv.org/abs/1711.01558) this kernel or some special cases (e.g. with alpha = 1/2 and c = 1: http://proceedings.mlr.press/v119/delbridge20a/delbridge20a.pdf) are called "inverse multiquadratic kernel". As far as I know, however, the traditional name is "inverse multiquadric kernel" (see e.g. Schölkopf and Smola's "Learning with Kernels").

@devmotion devmotion changed the title Add InverseMultiquadricKernel Add InverseMultiQuadricKernel Nov 2, 2021
@codecov
Copy link

codecov bot commented Nov 2, 2021

Codecov Report

Merging #396 (62c429d) into master (360ce10) will increase coverage by 0.04%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #396      +/-   ##
==========================================
+ Coverage   89.23%   89.27%   +0.04%     
==========================================
  Files          52       52              
  Lines        1198     1212      +14     
==========================================
+ Hits         1069     1082      +13     
- Misses        129      130       +1     
Impacted Files Coverage Δ
src/KernelFunctions.jl 100.00% <ø> (ø)
src/basekernels/rational.jl 93.18% <92.85%> (-0.16%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 360ce10...62c429d. Read the comment docs.

@doc raw"""
InverseMultiQuadricKernel(; α::Real=1.0, c::Real=1.0, metric=Euclidean())

Inverse multiquadric kernel with respect to the `metric` with parameters `α` and `c`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this sentence is needed, it does not bring anything

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I guess one has to know at least what the inverse multiquadric kernel is. However, the same problem exists in all other docstrings. I added this sentence only to be consistent with them.

For inputs ``x, x'`` and metric ``d(\cdot, \cdot)``, the inverse multiquadric kernel with
parameters ``\alpha, c > 0`` is defined as
```math
k(x, x'; \alpha, c) = \big(c + d(x, x')^2\big)^{-\alpha}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this, it looks extremely similar to the polynomial kernel (except for -alpha < 0). Could this eventually be unified?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it is more similar to the rational quadratic kernel, therefore I put it in this file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the tests show it is the same as scaling an RQ kernel with rescaled inputs. The construction is a bit annoying though, so the question is more: should it be a separate kernel or a function that constructs the corresponding RQ kernel?

src/basekernels/rational.jl Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

2 participants