Skip to content

Commit 401d556

Browse files
authored
Small clarification in train-kernel-parameters notebook (JuliaGaussianProcesses#496)
* Small clarification in train-kernel-parameters notebook * set remaining `passes` to true for piecewisepolynomial tests - now passing
1 parent 00d36a9 commit 401d556

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

examples/train-kernel-parameters/script.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ plot!(x_test, sinc; label="true function")
4242
# A simple way to ensure that the kernel parameters are positive
4343
# is to optimize over the logarithm of the parameters.
4444

45-
function kernelcall(θ)
45+
function kernel_creator(θ)
4646
return (exp(θ[1]) * SqExponentialKernel() + exp(θ[2]) * Matern32Kernel())
4747
ScaleTransform(exp(θ[3]))
4848
end
@@ -52,7 +52,7 @@ nothing #hide
5252
# the kernel parameters and normalization constant:
5353

5454
function f(x, x_train, y_train, θ)
55-
k = kernelcall(θ[1:3])
55+
k = kernel_creator(θ[1:3])
5656
return kernelmatrix(k, x, x_train) *
5757
((kernelmatrix(k, x_train) + exp(θ[4]) * I) \ y_train)
5858
end
@@ -133,15 +133,15 @@ raw_initial_θ = (
133133
flat_θ, unflatten = ParameterHandling.value_flatten(raw_initial_θ)
134134
flat_θ #hide
135135

136-
# We define a few relevant functions and note that compared to the previous `kernelcall` function, we do not need explicit `exp`s.
136+
# We define a few relevant functions and note that compared to the previous `kernel_creator` function, we do not need explicit `exp`s.
137137

138-
function kernelcall(θ)
138+
function kernel_creator(θ)
139139
return.k1 * SqExponentialKernel() + θ.k2 * Matern32Kernel()) ScaleTransform.k3)
140140
end
141141
nothing #hide
142142

143143
function f(x, x_train, y_train, θ)
144-
k = kernelcall(θ)
144+
k = kernel_creator(θ)
145145
return kernelmatrix(k, x, x_train) *
146146
((kernelmatrix(k, x_train) + θ.noise_var * I) \ y_train)
147147
end

test/basekernels/piecewisepolynomial.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949
nothing,
5050
example_inputs(StableRNG(123456), T)...;
5151
passes=(
52-
unary=(true, true, false),
53-
binary=(true, true, false),
54-
diag_unary=(true, true, false),
55-
diag_binary=(true, true, false),
52+
unary=(true, true, true),
53+
binary=(true, true, true),
54+
diag_unary=(true, true, true),
55+
diag_binary=(true, true, true),
5656
),
5757
)
5858
end

0 commit comments

Comments
 (0)