Skip to content

Commit b9f5ef1

Browse files
committed
Added missing kernels in the docs
1 parent 922f782 commit b9f5ef1

File tree

2 files changed

+107
-30
lines changed

2 files changed

+107
-30
lines changed

docs/src/kernels.md

Lines changed: 106 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,45 @@
66

77
These are the basic kernels without any transformation of the data. They are the building blocks of KernelFunctions
88

9+
10+
## Constant Kernels
11+
12+
### Constant Kernel
13+
14+
The [`ConstantKernel`](@ref) is defined as
15+
16+
```math
17+
k(x,x';c) = c,
18+
```
19+
20+
where $c \in \mathbb{R}$.
21+
22+
### White Kernel
23+
24+
The [`WhiteKernel`](@ref) is defined as
25+
26+
```math
27+
k(x,x') = \delta(x-x').
28+
```
29+
30+
### Zero Kernel
31+
32+
The [`ZeroKernel`](@ref) is defined as
33+
34+
```math
35+
k(x,x') = 0.
36+
```
37+
38+
## Cosine Kernel
39+
40+
The [`CosineKernel`](@ref) is defined as
41+
42+
```math
43+
k(x, x') = \cos(\pi |x-x'|),
44+
```
45+
46+
where $x\in\mathbb{R}$.
47+
948
## Exponential Kernels
1049

1150
### Exponential Kernel
@@ -25,11 +64,40 @@ The [`SqExponentialKernel`](@ref) is defined as
2564
### Gamma Exponential Kernel
2665

2766
The [`GammaExponentialKernel`](@ref) is defined as
67+
2868
```math
2969
k(x,x';\gamma) = \exp\left(-\|x-x'\|^{2\gamma}\right),
3070
```
3171
where $\gamma > 0$.
3272

73+
## Exponentiated Kernel
74+
75+
The [`ExponentiatedKernel`](@ref) is defined as
76+
77+
```math
78+
k(x,x') = \exp\left(\langle x,x'\rangle).
79+
```
80+
81+
## Fractional Brownian Motion
82+
83+
The [`FBMKernel`](@ref) is defined as
84+
85+
```math
86+
k(x,x';h) = \frac{|x|^{2h} + |x'|^{2h} - |x-x'|^{2h}}{2},
87+
```
88+
89+
where $h$ is the [Hurst index](https://en.wikipedia.org/wiki/Hurst_exponent#Generalized_exponent) and $0<h<1$.
90+
91+
## Gabor Kernel
92+
93+
The [`GaborKernel`](@ref) is defined as
94+
95+
```math
96+
k(x,x'; l,p) =& h(x-x';l,p)\\
97+
h(u;l,p) =& \exp\left(-\cos\left(\pi \sum_i \frac{u_i}{p_i}\right)\sum_i \frac{u_i^2}{l_i^2}\right),
98+
```
99+
where $l_i >0 $ is the lengthscale and $p_i>0$ is the period.
100+
33101
## Matern Kernels
34102

35103
### Matern Kernel
@@ -58,27 +126,35 @@ The [`Matern52Kernel`](@ref) is defined as
58126
k(x,x') = \left(1+\sqrt{5}|x-x'|+\frac{5}{2}\|x-x'\|^2\right)\exp\left(\sqrt{5}|x-x'|\right).
59127
```
60128

61-
## Rational Quadratic
129+
## Neural Network Kernel
62130

63-
### Rational Quadratic Kernel
131+
The [`NeuralNetworkKernel`](@ref) (as in the kernel for an infinitely wide neural network interpretated as a Gaussian process) is defined as
64132

65-
The [`RationalQuadraticKernel`](@ref) is defined as
133+
```math
134+
k(x, x') = \arcsin\left(\frac{\langle x, x'\rangle}{\sqrt{(1+\langle x, x\rangle)(1+\langle x',x'\rangle)}}\right).
135+
```
136+
137+
## Periodic Kernel
138+
139+
The [`PeriodicKernel`](@ref) is defined as
66140

67141
```math
68-
k(x,x';\alpha) = \left(1+\frac{\|x-x'\|^2}{\alpha}\right)^{-\alpha},
142+
k(x,x';r) = \exp\left(-0.5 \sum_i (sin (π(x_i - x'_i))/r_i)^2\right),
69143
```
70144

71-
where $\alpha > 0$.
145+
where $r$ has the same dimension as $x$ and $r_i >0$.
72146

73-
### Gamma Rational Quadratic Kernel
147+
## Piecewise Polynomial Kernel
74148

75-
The [`GammaRationalQuadraticKernel`](@ref) is defined as
149+
The [`PiecewisePolynomialKernel`](@ref) is defined as
76150

77151
```math
78-
k(x,x';\alpha,\gamma) = \left(1+\frac{\|x-x'\|^{2\gamma}}{\alpha}\right)^{-\alpha},
152+
k(x,x'; P, V) =& \max(1 - r, 0)^{j + V} f(r, j),\\
153+
r =& x^\top P x',\\
154+
j =& \lfloor \frac{D}{2}\rfloor + V + 1,
79155
```
80-
81-
where $\alpha > 0$ and $\gamma > 0$.
156+
where $x\in \mathbb{R}^D$, $V \in \{0,1,2,3\} and $P$ is a positive definite matrix.
157+
$f$ is a piecewise polynomial (see source code).
82158

83159
## Polynomial Kernels
84160

@@ -102,45 +178,46 @@ The [`PolynomialKernel`](@ref) is defined as
102178

103179
where $c \in \mathbb{R}$ and $d>0$
104180

105-
## Periodic Kernels
106181

107-
### Periodic Kernel
182+
## Rational Quadratic
108183

109-
The [`PeriodicKernel`](@ref) is defined as
184+
### Rational Quadratic Kernel
185+
186+
The [`RationalQuadraticKernel`](@ref) is defined as
110187

111188
```math
112-
k(x,x';r) = \exp\left(-0.5 \sum_i (sin (π(x_i - x'_i))/r_i)^2\right),
189+
k(x,x';\alpha) = \left(1+\frac{\|x-x'\|^2}{\alpha}\right)^{-\alpha},
113190
```
114191

115-
where $r$ has the same dimension as $x$ and $r_i >0$.
116-
117-
## Constant Kernels
192+
where $\alpha > 0$.
118193

119-
### Constant Kernel
194+
### Gamma Rational Quadratic Kernel
120195

121-
The [`ConstantKernel`](@ref) is defined as
196+
The [`GammaRationalQuadraticKernel`](@ref) is defined as
122197

123198
```math
124-
k(x,x';c) = c,
199+
k(x,x';\alpha,\gamma) = \left(1+\frac{\|x-x'\|^{2\gamma}}{\alpha}\right)^{-\alpha},
125200
```
126201

127-
where $c \in \mathbb{R}$.
202+
where $\alpha > 0$ and $\gamma > 0$.
128203

129-
### White Kernel
204+
## Spectral Mixture Kernel
130205

131-
The [`WhiteKernel`](@ref) is defined as
206+
The spectral mixture kernel is called by [`spectral_mixture_kernel`](@ref).
132207

133-
```math
134-
k(x,x') = \delta(x-x').
135-
```
136208

137-
### Zero Kernel
209+
## Wiener Kernel
138210

139-
The [`ZeroKernel`](@ref) is defined as
211+
The [`WienerKernel`](@ref) is defined as
140212

141213
```math
142-
k(x,x') = 0.
214+
k(x,x';i) = \left\{\begin{array}{cc}
215+
\delta(x, x') & i = -1\\
216+
\min(x,x') & i = 0\\
217+
\frac{\min(x,x')^{2i+1}}{a_i} + b_i \min(x,x')^{i+1}|x-x'|r_i(x,x') & i\geq 1
218+
\end{array}\right.,
143219
```
220+
where $i\in\{-1,0,1,2,3\}$ and coefficients $a_i$, $b_i$ are fixed and residuals $r_i$ are defined in the code.
144221

145222
# Composite Kernels
146223

src/basekernels/gabor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
GaborKernel(; ell::Real=1.0, p::Real=1.0)
33
4-
Gabor kernel with length scale ell and period p. Given by
4+
Gabor kernel with lengthscale `ell` and period `p`. Given by
55
```math
66
κ(x,y) = h(x-z), h(t) = exp(-sum(t.^2./(ell.^2)))*cos(pi*sum(t./p))
77
```

0 commit comments

Comments
 (0)