You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/userguide.md
+22-13Lines changed: 22 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,23 +7,25 @@ For example, a square exponential kernel is created by
7
7
```julia
8
8
k =SqExponentialKernel()
9
9
```
10
-
Instead of having lengthscale(s) for each kernel we use [`Transform`](@ref) objects which act on the inputs before passing them to the kernel.
11
-
For example, to premultiply the input by 2.0 (equivalent to a lengthscale of 0.5) we can use the following options:
10
+
11
+
!!! tip "How do I set the lengthscale?"
12
+
Instead of having lengthscale(s) for each kernel we use [`Transform`](@ref) objects which act on the inputs before passing them to the kernel. Note that the transforms such as [`ScaleTransform`](@ref) and [`ARDTransform`](@ref)_multiply_ the input by a scale factor, which corresponds to the _inverse_ of the lengthscale.
13
+
For example, a lengthscale of 0.5 is equivalent to premultiplying the input by 2.0, and you can create the corresponding kernel as follows:
12
14
```julia
13
-
k =transform(SqExponentialKernel(), ScaleTransform(2.0)) # returns a TransformedKernel
14
-
k =TransformedKernel(SqExponentialKernel(), ScaleTransform(2.0))
15
+
k =transform(SqExponentialKernel(), 2.0)
16
+
k =TransformedKernel(SqExponentialKernel(), ScaleTransform(2.0))# equivalent explicit construction
15
17
```
16
-
Check the [`Transform`](@ref) page to see all available transforms.
18
+
Check the [Input Transforms](@ref) page for more details. The API documentation contains an [overview of all available transforms](@ref Transforms).
17
19
18
20
To premultiply the kernel by a variance, you can use `*` or create a `ScaledKernel`:
19
21
```julia
20
-
k =3.0*SqExponentialKernel()
21
-
k =ScaledKernel(SqExponentialKernel(), 3.0)
22
+
k =3.0*SqExponentialKernel()
23
+
k =ScaledKernel(SqExponentialKernel(), 3.0)# equivalent explicit constructions
22
24
```
23
25
24
26
## Using a kernel function
25
27
26
-
To compute the kernel function on two vectors you can call
28
+
To evaluate the kernel function on two vectors you simply call the kernel object:
27
29
```julia
28
30
k =SqExponentialKernel()
29
31
x1 =rand(3)
@@ -76,12 +78,19 @@ For example:
76
78
77
79
## Kernel parameters
78
80
79
-
What if you want to differentiate through the kernel parameters? Even in a highly nested structure such as:
81
+
What if you want to differentiate through the kernel parameters? This is easy even in a highly nested structure such as:
80
82
```julia
81
-
k =transform(0.5*SqExponentialKernel()*MaternKernel() +0.2*(transform(LinearKernel(), 2.0) +PolynomialKernel()), [0.1, 0.5])
0 commit comments