Skip to content

Commit 03c96d9

Browse files
committed
Removed BaseKernel
1 parent 86cde32 commit 03c96d9

File tree

8 files changed

+8
-16
lines changed

8 files changed

+8
-16
lines changed

src/KernelFunctions.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ Abstract type defining a slice-wise transformation on an input matrix
4848
abstract type Transform end
4949

5050
abstract type Kernel end
51-
abstract type BaseKernel <: Kernel end
52-
abstract type SimpleKernel <: BaseKernel end
51+
abstract type SimpleKernel <: Kernel end
5352

5453
include("utils.jl")
5554
include("distances/pairwise.jl")

src/basekernels/fbm.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Fractional Brownian motion kernel with Hurst index `h` from (0,1) given by
99
For `h=1/2`, this is the Wiener Kernel, for `h>1/2`, the increments are
1010
positively correlated and for `h<1/2` the increments are negatively correlated.
1111
"""
12-
struct FBMKernel{T<:Real} <: BaseKernel
12+
struct FBMKernel{T<:Real} <: Kernel
1313
h::Vector{T}
1414
function FBMKernel(; h::T=0.5) where {T<:Real}
1515
@assert 0.0 <= h <= 1.0 "FBMKernel: Given Hurst index h is invalid."

src/basekernels/gabor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Gabor kernel with lengthscale `ell` and period `p`. Given by
77
```
88
99
"""
10-
struct GaborKernel{K<:Kernel} <: BaseKernel
10+
struct GaborKernel{K<:Kernel} <: Kernel
1111
kernel::K
1212
function GaborKernel(;ell=nothing, p=nothing)
1313
k = _gabor(ell=ell, p=p)

src/basekernels/nn.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Bayesian neural network with erf (Error Function) as activation function.
1717
- [Neal(1996)](https://www.cs.toronto.edu/~radford/bnn.book.html)
1818
- [Andrew Gordon's Thesis Pg 45](http://www.cs.cmu.edu/~andrewgw/andrewgwthesis.pdf)
1919
"""
20-
struct NeuralNetworkKernel <: BaseKernel end
20+
struct NeuralNetworkKernel <: Kernel end
2121

2222
function::NeuralNetworkKernel)(x, y)
2323
return asin(dot(x, y) / sqrt((1 + sum(abs2, x)) * (1 + sum(abs2, y))))

src/basekernels/wiener.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ See the paper *Probabilistic ODE Solvers with Runge-Kutta Means* by Schober, Duv
3232
Hennig, NIPS, 2014, for more details.
3333
3434
"""
35-
struct WienerKernel{I} <: BaseKernel
35+
struct WienerKernel{I} <: Kernel
3636
function WienerKernel{I}() where I
3737
@assert I (-1, 0, 1, 2, 3) "Invalid parameter i=$(I). Should be -1, 0, 1, 2 or 3."
3838
if I == -1

src/generic.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,5 @@ function concretetypes(k, ktypes::Vector)
1111
return ktypes
1212
end
1313

14-
for k in nameof.(subtypes(BaseKernel))
15-
@eval begin
16-
@deprecate($k::Real;args...),transform($k(args...),ρ))
17-
@deprecate($k::AbstractVector{<:Real};args...),transform($k(args...),ρ))
18-
end
19-
end
20-
2114
# Fallback implementation of evaluate for `SimpleKernel`s.
2215
(k::SimpleKernel)(x, y) = kappa(k, evaluate(metric(k), x, y))

test/matrix/kernelmatrix.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Custom Kernel implementation that only defines how to evaluate itself. This is used to
22
# test that fallback kernelmatrix / kerneldiagmatrix methods work properly.
3-
struct BaseSE <: KernelFunctions.BaseKernel end
3+
struct BaseSE <: KernelFunctions.Kernel end
44
(k::BaseSE)(x, y) = exp(-evaluate(SqEuclidean(), x, y))
55

66
# Custom kernel to test `SimpleKernel` interface on, independently the `SimpleKernel`s that
@@ -90,7 +90,7 @@ KernelFunctions.kappa(::ToySimpleKernel, d) = exp(-d / 2)
9090

9191
tmp_diag = Vector{Float64}(undef, length(x))
9292
@test kerneldiagmatrix!(tmp_diag, k, x) kerneldiagmatrix(k, x)
93-
@test_throws DimensionMismatch kerneldiagmatrix!(tmp_diag, k, y)
93+
@test_throws DimensionMismatch kerneldiagmatrix!(tmp_diag, k, y)
9494
end
9595
end
9696

test/mokernels/independent.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
k = IndependentMOKernel(GaussianKernel())
66
@test k isa IndependentMOKernel
77
@test k isa Kernel
8-
@test k.kernel isa KernelFunctions.BaseKernel
8+
@test k.kernel isa KernelFunctions.Kernel
99
@test k(x[2], y[2]) isa Real
1010

1111
@test kernelmatrix(k, x, y) == kernelmatrix(k, collect(x), collect(y))

0 commit comments

Comments
 (0)