Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Matthias Mayr
limbo
Commits
c3d1de0a
Commit
c3d1de0a
authored
Dec 19, 2017
by
Antoine Cully
Browse files
fixed the gradient computation of squared_exp_ard kernel
parent
e5ebd35e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/limbo/kernel/squared_exp_ard.hpp
View file @
c3d1de0a
...
...
@@ -114,9 +114,11 @@ namespace limbo {
double
k
=
_sf2
*
std
::
exp
(
-
0.5
*
z
);
grad
.
head
(
_input_dim
)
=
(
x1
-
x2
).
cwiseQuotient
(
_ell
).
array
().
square
()
*
k
;
Eigen
::
MatrixXd
G
=
-
k
*
(
x1
-
x2
).
norm
()
*
_A
;
for
(
size_t
j
=
0
;
j
<
(
unsigned
int
)
Params
::
kernel_squared_exp_ard
::
k
();
++
j
)
grad
.
segment
((
j
+
1
)
*
_input_dim
,
_input_dim
)
=
G
.
col
(
j
);
for
(
size_t
j
=
0
;
j
<
(
unsigned
int
)
Params
::
kernel_squared_exp_ard
::
k
();
++
j
)
{
Eigen
::
MatrixXd
G
=
-
(
x1
-
x2
).
transpose
()
*
_A
.
col
(
j
)
*
(
x1
-
x2
).
cwiseProduct
(
_A
.
col
(
j
))
*
k
;
grad
.
segment
((
j
+
1
)
*
_input_dim
,
_input_dim
)
=
G
;
}
grad
(
grad
.
size
()
-
1
)
=
2
*
k
;
...
...
src/tests/test_kernel.cpp
View file @
c3d1de0a
...
...
@@ -188,10 +188,11 @@ BOOST_AUTO_TEST_CASE(test_grad_SE_ARD)
}
// THIS TEST FAILS!
// Params::kernel_squared_exp_ard::set_k(1);
// for (int i = 1; i <= 10; i++) {
// check_kernel<kernel::SquaredExpARD<Params>>(i, 100);
// }
std
::
cout
<<
"START"
<<
std
::
endl
;
Params
::
kernel_squared_exp_ard
::
set_k
(
1
);
for
(
int
i
=
1
;
i
<=
10
;
i
++
)
{
check_kernel
<
kernel
::
SquaredExpARD
<
Params
>>
(
i
,
100
);
}
}
BOOST_AUTO_TEST_CASE
(
test_kernel_SE_ARD
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment