Skip to content

Extend lengthscale tip #476

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

Merged
merged 5 commits into from
Sep 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/src/userguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ For example, a squared exponential kernel is created by
```
[`with_lengthscale`](@ref) also works with vector-valued lengthscales for ARD.
Check the [Input Transforms](@ref input_transforms) page for more details.
Per-dimension lengthscales for automatic relevance determination work in a similar manner:
```julia
inverse_length_scales = [1.0, 2.0]
k = SqExponentialKernel() ∘ ARDTransform(inverse_length_scales)
k = compose(SqExponentialKernel(), ARDTransform(inverse_length_scales))
```
Copy link
Member

Choose a reason for hiding this comment

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

I thought commonly one would just use with_lengthscale? ARD is actually mentioned two lines above 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh. I hadn't realised that is a thing! Maybe I should just add an example with a vector of lengthscales to the tip then, rather than extending substantially? And maybe change the title to "How do I set the lengthscale(s)?"?

Copy link
Member

Choose a reason for hiding this comment

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

I think these are good suggestions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Have tweaked -- let me know if you think it works.

More generally, you can utilise arbitrary matrices via [`LinearTransform`](@ref).
For example, this can be used to project inputs from high- to low- dimensions:
```julia
A = randn(1, 2)
k = compose(SqExponentialKernel(), LinearTransform(A))
```
In this case, we map from `2` to `1` dimension.

!!! tip "How do I set the kernel variance?"
To premultiply the kernel by a variance, you can use `*` with a scalar number:
Expand Down