@@ -22,28 +22,28 @@ function KernelSum(
22
22
)
23
23
@assert length (kernels) == length (weights) " Weights and kernel vector should be of the same length"
24
24
@assert all (weights .>= 0 ) " All weights should be positive"
25
- KernelSum (kernels, weights)
25
+ return KernelSum (kernels, weights)
26
26
end
27
27
28
28
params (k:: KernelSum ) = (k. weights, params .(k. kernels))
29
29
opt_params (k:: KernelSum ) = (k. weights, opt_params .(k. kernels))
30
30
31
31
Base.:+ (k1:: Kernel , k2:: Kernel ) = KernelSum ([k1, k2], weights = [1.0 , 1.0 ])
32
- Base.:+ (k1:: ScaledKernel , k2:: ScaledKernel ) = KernelSum ([kernel (k1), kernel (k2)], weights = [first (k1. σ), first (k2. σ)])
32
+ Base.:+ (k1:: ScaledKernel , k2:: ScaledKernel ) = KernelSum ([kernel (k1), kernel (k2)], weights = [first (k1. σ² ), first (k2. σ² )])
33
33
Base.:+ (k1:: KernelSum , k2:: KernelSum ) =
34
34
KernelSum (vcat (k1. kernels, k2. kernels), weights = vcat (k1. weights, k2. weights))
35
35
Base.:+ (k:: Kernel , ks:: KernelSum ) =
36
36
KernelSum (vcat (k, ks. kernels), weights = vcat (1.0 , ks. weights))
37
37
Base.:+ (k:: ScaledKernel , ks:: KernelSum ) =
38
- KernelSum (vcat (kernel (k), ks. kernels), weights = vcat (first (k. σ), ks. weights))
38
+ KernelSum (vcat (kernel (k), ks. kernels), weights = vcat (first (k. σ² ), ks. weights))
39
39
Base.:+ (k:: ScaledKernel , ks:: Kernel ) =
40
- KernelSum (vcat (kernel (k), ks), weights = vcat (first (k. σ), 1.0 ))
40
+ KernelSum (vcat (kernel (k), ks), weights = vcat (first (k. σ² ), 1.0 ))
41
41
Base.:+ (ks:: KernelSum , k:: Kernel ) =
42
42
KernelSum (vcat (ks. kernels, k), weights = vcat (ks. weights, 1.0 ))
43
43
Base.:+ (ks:: KernelSum , k:: ScaledKernel ) =
44
- KernelSum (vcat (ks. kernels, kernel (k)), weights = vcat (ks. weights, first (k. σ)))
44
+ KernelSum (vcat (ks. kernels, kernel (k)), weights = vcat (ks. weights, first (k. σ² )))
45
45
Base.:+ (ks:: Kernel , k:: ScaledKernel ) =
46
- KernelSum (vcat (ks, kernel (k)), weights = vcat (1.0 , first (k. σ)))
46
+ KernelSum (vcat (ks, kernel (k)), weights = vcat (1.0 , first (k. σ² )))
47
47
Base.:* (w:: Real , k:: KernelSum ) = KernelSum (k. kernels, weights = w * k. weights) # TODO add tests
48
48
49
49
Base. length (k:: KernelSum ) = length (k. kernels)
0 commit comments