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
9bd4bb12
Commit
9bd4bb12
authored
Oct 05, 2016
by
Vaios Papaspyros
Browse files
Naming conventions - Expected Constrained Improvement rather than Constrained EI
parent
ca437ae9
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/examples/experimental/co
nstrained_ei
.cpp
→
src/examples/experimental/c
b
o.cpp
View file @
9bd4bb12
#include
<limbo/limbo.hpp>
#include
<limbo/experimental/bayes_opt/cboptimizer.hpp>
#include
<limbo/experimental/acqui/
c
ei.hpp>
#include
<limbo/experimental/acqui/e
c
i.hpp>
using
namespace
limbo
;
...
...
@@ -25,7 +25,7 @@ struct Params {
BO_PARAM
(
int
,
iterations
,
100
);
};
struct
acqui_
c
ei
:
public
defaults
::
acqui_
c
ei
{
struct
acqui_e
c
i
:
public
defaults
::
acqui_e
c
i
{
};
struct
mean_constant
{
...
...
@@ -82,7 +82,7 @@ int main()
using
GP_t
=
model
::
GP
<
Params
,
Kernel_t
,
Mean_t
>
;
using
Constrained_GP_t
=
model
::
GP
<
Params
,
Kernel_t
,
Mean_t
>
;
using
Acqui_t
=
experimental
::
acqui
::
C
EI
<
Params
,
GP_t
,
Constrained_GP_t
>
;
using
Acqui_t
=
experimental
::
acqui
::
E
C
I
<
Params
,
GP_t
,
Constrained_GP_t
>
;
using
Init_t
=
init
::
RandomSampling
<
Params
>
;
experimental
::
bayes_opt
::
CBOptimizer
<
Params
,
...
...
src/examples/experimental/wscript
View file @
9bd4bb12
...
...
@@ -80,8 +80,8 @@ def build(bld):
defines
=
'NSBO'
,
use
=
'limbo'
)
obj
=
bld
.
program
(
features
=
'cxx'
,
source
=
'co
nstrained_ei
.cpp'
,
source
=
'c
b
o.cpp'
,
includes
=
'.. ../.. ../../../'
,
target
=
'co
nstrained_ei
'
,
target
=
'c
b
o'
,
uselib
=
'BOOST EIGEN TBB SFERES LIBCMAES NLOPT'
,
use
=
'limbo'
)
src/limbo/experimental/acqui/
c
ei.hpp
→
src/limbo/experimental/acqui/e
c
i.hpp
View file @
9bd4bb12
...
...
@@ -42,8 +42,8 @@
//| The fact that you are presently reading this means that you have had
//| knowledge of the CeCILL-C license and that you accept its terms.
//|
#ifndef LIMBO_ACQUI_
C
EI_HPP
#define LIMBO_ACQUI_
C
EI_HPP
#ifndef LIMBO_ACQUI_E
C
I_HPP
#define LIMBO_ACQUI_E
C
I_HPP
#include
<cmath>
#include
<vector>
...
...
@@ -53,7 +53,7 @@
namespace
limbo
{
namespace
defaults
{
struct
acqui_
c
ei
{
struct
acqui_e
c
i
{
/// @ingroup acqui_defaults
BO_PARAM
(
double
,
jitter
,
0.0
);
};
...
...
@@ -62,9 +62,9 @@ namespace limbo {
namespace
experimental
{
namespace
acqui
{
template
<
typename
Params
,
typename
Model
,
typename
ConstraintModel
>
class
C
EI
{
class
E
C
I
{
public:
C
EI
(
const
Model
&
model
,
const
ConstraintModel
&
constraint_model
,
int
iteration
=
0
)
E
C
I
(
const
Model
&
model
,
const
ConstraintModel
&
constraint_model
,
int
iteration
=
0
)
:
_model
(
model
),
_constraint_model
(
constraint_model
)
{}
size_t
dim_in
()
const
{
return
_model
.
dim_in
();
}
...
...
@@ -83,7 +83,7 @@ namespace limbo {
if
(
sigma
<
1e-10
||
_model
.
samples
().
size
()
<
1
)
return
0.0
;
// Compute constrained
EI(x)
// Compute
expected
constrained
improvement
// First find the best (predicted) observation so far
// (We are zeroing infeasible samples subject to the constraint value)
std
::
vector
<
double
>
rewards
;
...
...
@@ -92,7 +92,7 @@ namespace limbo {
double
f_max
=
*
std
::
max_element
(
rewards
.
begin
(),
rewards
.
end
());
// Calculate Z and \Phi(Z) and \phi(Z)
double
X
=
afun
(
mu
)
-
f_max
-
Params
::
acqui_
c
ei
::
jitter
();
double
X
=
afun
(
mu
)
-
f_max
-
Params
::
acqui_e
c
i
::
jitter
();
double
Z
=
X
/
sigma
;
double
phi
=
std
::
exp
(
-
0.5
*
std
::
pow
(
Z
,
2.0
))
/
std
::
sqrt
(
2.0
*
M_PI
);
double
Phi
=
0.5
*
std
::
erfc
(
-
Z
/
std
::
sqrt
(
2
));
...
...
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