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
71c9278f
Commit
71c9278f
authored
Dec 15, 2015
by
Konstantinos Chatzilygeroudis
Browse files
Merge pull request #55 from resibots/main_loop_outputs
Move standard output to stats
parents
f98cbc04
d1ec1d26
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/limbo/bayes_opt/bo_base.hpp
View file @
71c9278f
...
...
@@ -20,6 +20,7 @@
#include
<limbo/stop/max_iterations.hpp>
#include
<limbo/stat/samples.hpp>
#include
<limbo/stat/aggregated_observations.hpp>
#include
<limbo/stat/console_summary.hpp>
#include
<limbo/tools/sys.hpp>
#include
<limbo/kernel/squared_exp_ard.hpp>
#include
<limbo/acqui/gp_ucb.hpp>
...
...
@@ -32,7 +33,7 @@
namespace
limbo
{
namespace
defaults
{
struct
bayes_opt_bobase
{
BO_PARAM
(
bool
,
stats_enabled
,
true
);
BO_PARAM
(
bool
,
stats_enabled
,
true
);
};
}
template
<
typename
BO
,
typename
AggregatorFunction
>
...
...
@@ -108,7 +109,7 @@ namespace limbo {
// WARNING: you have to specify the acquisition function
// if you use a custom model
typedef
acqui
::
GP_UCB
<
Params
,
model_t
>
acqui_t
;
// 4
typedef
boost
::
fusion
::
vector
<
stat
::
Samples
<
Params
>
,
stat
::
AggregatedObservations
<
Params
>>
stat_t
;
// 5
typedef
boost
::
fusion
::
vector
<
stat
::
Samples
<
Params
>
,
stat
::
AggregatedObservations
<
Params
>
,
stat
::
ConsoleSummary
<
Params
>
>
stat_t
;
// 5
typedef
boost
::
fusion
::
vector
<
stop
::
MaxIterations
<
Params
>>
stop_t
;
// 6
};
...
...
@@ -165,7 +166,7 @@ namespace limbo {
this
->
_total_iterations
=
0
;
this
->
_samples
.
clear
();
this
->
_observations
.
clear
();
this
->
_bl_samples
.
clear
();
this
->
_bl_samples
.
clear
();
}
if
(
this
->
_total_iterations
==
0
)
...
...
src/limbo/bayes_opt/boptimizer.hpp
View file @
71c9278f
...
...
@@ -65,8 +65,8 @@ namespace limbo {
this
->
_init
(
sfun
,
afun
,
reset
);
if
(
!
this
->
_observations
.
empty
())
_model
.
compute
(
this
->
_samples
,
this
->
_observations
,
Params
::
bayes_opt_boptimizer
::
noise
(),
this
->
_bl_samples
);
_model
.
compute
(
this
->
_samples
,
this
->
_observations
,
Params
::
bayes_opt_boptimizer
::
noise
(),
this
->
_bl_samples
);
acqui_optimizer_t
acqui_optimizer
;
while
(
this
->
_samples
.
size
()
==
0
||
!
this
->
_stop
(
*
this
,
afun
))
{
...
...
@@ -86,23 +86,6 @@ namespace limbo {
this
->
_update_stats
(
*
this
,
afun
,
blacklisted
);
std
::
cout
<<
this
->
_current_iteration
<<
" new point: "
<<
(
blacklisted
?
this
->
_bl_samples
.
back
()
:
this
->
_samples
.
back
()).
transpose
();
if
(
blacklisted
)
std
::
cout
<<
" value: "
<<
"No data, blacklisted"
;
else
std
::
cout
<<
" value: "
<<
afun
(
this
->
_observations
.
back
());
// std::cout << " mu: "<< _model.mu(blacklisted ? this->_bl_samples.back()
// : this->_samples.back()).transpose()
//<< " mean: " << _model.mean_function()(new_sample, _model).transpose()
//<< " sigma: "<< _model.sigma(blacklisted ? this->_bl_samples.back() :
//this->_samples.back())
//<< " acqui: "<< acqui(blacklisted ? this->_bl_samples.back() :
//this->_samples.back(), afun)
std
::
cout
<<
" best:"
<<
afun
(
this
->
best_observation
(
afun
))
<<
std
::
endl
;
if
(
!
this
->
_observations
.
empty
())
_model
.
compute
(
this
->
_samples
,
this
->
_observations
,
Params
::
bayes_opt_boptimizer
::
noise
(),
this
->
_bl_samples
);
...
...
src/limbo/stat.hpp
View file @
71c9278f
...
...
@@ -5,6 +5,7 @@
#include
<limbo/stat/best_observations.hpp>
#include
<limbo/stat/best_samples.hpp>
#include
<limbo/stat/bl_samples.hpp>
#include
<limbo/stat/console_summary.hpp>
#include
<limbo/stat/aggregated_observations.hpp>
#include
<limbo/stat/observations.hpp>
#include
<limbo/stat/gp_acquisitions.hpp>
...
...
src/limbo/stat/console_summary.hpp
0 → 100644
View file @
71c9278f
#ifndef LIMBO_STAT_CONSOLE_SUMMARY_HPP
#define LIMBO_STAT_CONSOLE_SUMMARY_HPP
#include
<limbo/stat/stat_base.hpp>
namespace
limbo
{
namespace
stat
{
template
<
typename
Params
>
struct
ConsoleSummary
:
public
StatBase
<
Params
>
{
template
<
typename
BO
,
typename
AggregatorFunction
>
void
operator
()(
const
BO
&
bo
,
const
AggregatorFunction
&
afun
,
bool
blacklisted
)
{
if
(
!
bo
.
stats_enabled
()
||
bo
.
observations
().
empty
())
return
;
std
::
cout
<<
bo
.
total_iterations
()
<<
" new point: "
<<
(
blacklisted
?
bo
.
bl_samples
().
back
()
:
bo
.
samples
().
back
()).
transpose
();
if
(
blacklisted
)
std
::
cout
<<
" value: "
<<
"No data, blacklisted"
;
else
std
::
cout
<<
" value: "
<<
afun
(
bo
.
observations
().
back
());
std
::
cout
<<
" best:"
<<
afun
(
bo
.
best_observation
(
afun
))
<<
std
::
endl
;
}
};
}
}
#endif
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