Commit 9c1d7acb authored by Konstantinos Chatzilygeroudis's avatar Konstantinos Chatzilygeroudis
Browse files

Renamed folders/namespaces

parent 8bdcf275
......@@ -54,10 +54,10 @@ struct fit_eval {
int main()
{
typedef kernel_fun::MaternFiveHalfs<Params> Kernel_t;
typedef mean_fun::Data<Params> Mean_t;
typedef models::GP<Params, Kernel_t, Mean_t> GP_t;
typedef acqui_fun::UCB<Params, GP_t> Acqui_t;
typedef kernel::MaternFiveHalfs<Params> Kernel_t;
typedef mean::Data<Params> Mean_t;
typedef model::GP<Params, Kernel_t, Mean_t> GP_t;
typedef acqui::UCB<Params, GP_t> Acqui_t;
bayes_opt::BOptimizer<Params, modelfun<GP_t>, acquifun<Acqui_t>> opt;
opt.optimize(fit_eval());
......
......@@ -68,10 +68,10 @@ struct SecondElem {
int main()
{
typedef kernel_fun::MaternFiveHalfs<Params> Kernel_t;
typedef mean_fun::Data<Params> Mean_t;
typedef models::GP<Params, Kernel_t, Mean_t> GP_t;
typedef acqui_fun::GP_UCB<Params, GP_t> Acqui_t;
typedef kernel::MaternFiveHalfs<Params> Kernel_t;
typedef mean::Data<Params> Mean_t;
typedef model::GP<Params, Kernel_t, Mean_t> GP_t;
typedef acqui::GP_UCB<Params, GP_t> Acqui_t;
bayes_opt::BOptimizer<Params, modelfun<GP_t>, acquifun<Acqui_t>> opt;
......
......@@ -4,7 +4,7 @@
#include <limbo/limbo.hpp>
#include <limbo/inner_opt/cmaes.hpp>
#include <limbo/models/gp_auto_mean.hpp>
#include <limbo/model/gp_auto_mean.hpp>
using namespace limbo;
......@@ -151,9 +151,9 @@ struct fit_eval {
int main()
{
typedef kernel_fun::SquaredExpARD<Params> Kernel_t;
typedef mean_fun::FunctionARD<Params, MeanComplet<Params>> Mean_t;
typedef models::GPAutoMean<Params, Kernel_t, Mean_t> GP_t;
typedef kernel::SquaredExpARD<Params> Kernel_t;
typedef mean::FunctionARD<Params, MeanComplet<Params>> Mean_t;
typedef model::GPAutoMean<Params, Kernel_t, Mean_t> GP_t;
typedef UCB_multi<Params, GP_t> Acqui_t;
bayes_opt::BOptimizer<Params, modelfun<GP_t>, acquifun<Acqui_t>> opt;
......
#ifndef ACQUISITION_FUNCTIONS_HPP_
#define ACQUISITION_FUNCTIONS_HPP_
#include <limbo/acqui_fun/ucb.hpp>
#include <limbo/acqui_fun/gp_ucb.hpp>
#include <limbo/acqui_fun/ehvi.hpp>
#include <limbo/acqui/ucb.hpp>
#include <limbo/acqui/gp_ucb.hpp>
#include <limbo/acqui/ehvi.hpp>
#endif
......@@ -4,7 +4,7 @@
#include <ehvi/ehvi_calculations.h>
namespace limbo {
namespace acqui_fun {
namespace acqui {
// only work in 2D for now
template <typename Params, typename Model>
class Ehvi {
......
......@@ -11,7 +11,7 @@ namespace limbo {
};
}
namespace acqui_fun {
namespace acqui {
template <typename Params, typename Model>
class GP_UCB {
public:
......
......@@ -11,7 +11,7 @@ namespace limbo {
};
}
namespace acqui_fun {
namespace acqui {
template <typename Params, typename Model>
class UCB {
public:
......
......@@ -15,16 +15,16 @@
#include <limits>
// we need everything to have the defaults
#include <limbo/stop_crit/chain_criteria.hpp>
#include <limbo/stop_crit/max_iterations.hpp>
#include <limbo/stats/acquisitions.hpp>
#include <limbo/misc/sys.hpp>
#include <limbo/kernel_fun/squared_exp_ard.hpp>
#include <limbo/acqui_fun/gp_ucb.hpp>
#include <limbo/mean_fun/data.hpp>
#include <limbo/stop/chain_criteria.hpp>
#include <limbo/stop/max_iterations.hpp>
#include <limbo/stat/acquisitions.hpp>
#include <limbo/tools/sys.hpp>
#include <limbo/kernel/squared_exp_ard.hpp>
#include <limbo/acqui/gp_ucb.hpp>
#include <limbo/mean/data.hpp>
#include <limbo/inner_opt/cmaes.hpp>
#include <limbo/models/gp_auto.hpp>
#include <limbo/init_fun/random_sampling.hpp>
#include <limbo/model/gp_auto.hpp>
#include <limbo/init/random_sampling.hpp>
namespace limbo {
......@@ -94,16 +94,16 @@ namespace limbo {
typedef Params params_t;
// defaults
struct defaults {
typedef init_fun::RandomSampling<Params> init_t; // 1
typedef init::RandomSampling<Params> init_t; // 1
typedef inner_opt::Cmaes<Params> inneropt_t; // 2
typedef kernel_fun::SquaredExpARD<Params> kf_t;
typedef mean_fun::Data<Params> mean_t;
typedef models::GPAuto<Params, kf_t, mean_t> model_t; // 3
typedef kernel::SquaredExpARD<Params> kf_t;
typedef mean::Data<Params> mean_t;
typedef model::GPAuto<Params, kf_t, mean_t> model_t; // 3
// WARNING: you have to specify the acquisition function
// if you use a custom model
typedef acqui_fun::GP_UCB<Params, model_t> acqui_t; // 4
typedef stats::Acquisitions<Params> stat_t; // 5
typedef boost::fusion::vector<stop_crit::MaxIterations<Params>> stop_t; // 6
typedef acqui::GP_UCB<Params, model_t> acqui_t; // 4
typedef stat::Acquisitions<Params> stat_t; // 5
typedef boost::fusion::vector<stop::MaxIterations<Params>> stop_t; // 6
typedef Eigen::VectorXd obs_t; // 7
};
......@@ -168,7 +168,7 @@ namespace limbo {
template <typename BO, typename AggregatorFunction>
bool _pursue(const BO& bo, const AggregatorFunction& afun) const
{
stop_crit::ChainCriteria<BO, AggregatorFunction> chain(bo, afun);
stop::ChainCriteria<BO, AggregatorFunction> chain(bo, afun);
return boost::fusion::accumulate(_stopping_criteria, true, chain);
}
......@@ -183,7 +183,7 @@ namespace limbo {
{
if (Params::boptimizer::dump_period() <= 0)
return;
_res_dir = misc::hostname() + "_" + misc::date() + "_" + misc::getpid();
_res_dir = tools::hostname() + "_" + tools::date() + "_" + tools::getpid();
boost::filesystem::path my_path(_res_dir);
boost::filesystem::create_directory(my_path);
}
......
......@@ -130,7 +130,7 @@ namespace limbo {
ea.set_fit_proto(multi::SferesFit<model_t>(_models));
ea.run();
auto pareto_front = ea.pareto_front();
par::sort(pareto_front.begin(), pareto_front.end(), sferes::fit::compare_objs_lex());
tools::par::sort(pareto_front.begin(), pareto_front.end(), sferes::fit::compare_objs_lex());
_pareto_model.resize(pareto_front.size());
Eigen::VectorXd point(D), objs(nb_objs()), sigma(nb_objs());
for (size_t p = 0; p < pareto_front.size(); ++p) {
......@@ -157,7 +157,7 @@ namespace limbo {
assert(points.size() == objs.size());
assert(sigma.size() == objs.size());
pareto_t p(points.size());
par::loop(0, p.size(), [&](size_t k) {
tools::par::loop(0, p.size(), [&](size_t k) {
// clang-format off
p[k] = std::make_tuple(points[k], objs[k], sigma[k]);
// clang-format on
......
......@@ -3,7 +3,7 @@
#include <algorithm>
#include <limbo/bayes_opt/bo_multi.hpp>
#include <limbo/acqui_fun/ehvi.hpp>
#include <limbo/acqui/ehvi.hpp>
#include <ehvi/ehvi_calculations.h>
#include <ehvi/ehvi_sliceupdate.h>
......@@ -46,7 +46,7 @@ namespace limbo {
std::cout << "optimizing ehvi (" << this->pareto_data().size() << ")"
<< std::endl;
auto acqui = acqui_fun::Ehvi<Params, model_t>(
auto acqui = acqui::Ehvi<Params, model_t>(
this->_models, pop,
Eigen::Vector3d(Params::ehvi::x_ref(), Params::ehvi::y_ref(), 0));
......@@ -66,7 +66,7 @@ namespace limbo {
return v1.second > v2.second;
// clang-format on
};
auto m = par::max(init, this->pareto_data().size(), body, comp);
auto m = tools::par::max(init, this->pareto_data().size(), body, comp);
// maximize with NSGA-II
auto body2 = [&](int i) {
......@@ -76,7 +76,7 @@ namespace limbo {
return std::make_pair(x, hv);
// clang-format on
};
auto m2 = par::max(init, this->pareto_model().size(), body2, comp);
auto m2 = tools::par::max(init, this->pareto_model().size(), body2, comp);
// take the best
std::cout << "best (cmaes):" << m.second << std::endl;
......
......@@ -2,7 +2,7 @@
#define PARETO_HPP
#include <algorithm>
#include <limbo/par/parallel.hpp>
#include <limbo/tools/parallel.hpp>
namespace pareto {
namespace impl {
......@@ -93,13 +93,13 @@ namespace pareto {
T pareto_set_std(const T& p)
{
#ifdef __GXX_EXPERIMENTAL_CXX0X__
typename par::vector<typename T::value_type>::type
typename limbo::tools::par::vector<typename T::value_type>::type
pareto; // old fashion way to create template alias (for GCC 4.6...)
#else
par::vector<typename T::value_type>
limbo::tools::par::vector<typename T::value_type>
pareto; // Using Template alias (for GCC 4.7 and later)
#endif
par::loop(0, p.size(), [&](size_t i) {
limbo::tools::par::loop(0, p.size(), [&](size_t i) {
// clang-format off
if (i % 10000 == 0)
{
......@@ -111,7 +111,7 @@ namespace pareto {
// clang-format on
});
std::sort(pareto.begin(), pareto.end(), compare_objs_lex<K>());
return par::convert_vector(pareto);
return limbo::tools::par::convert_vector(pareto);
}
// O(n lg n), for 2 objectives ONLY
......@@ -120,7 +120,7 @@ namespace pareto {
T sort_2objs(const T& v)
{
T p = v;
par::sort(p.begin(), p.end(), compare_objs_lex<K>());
limbo::tools::par::sort(p.begin(), p.end(), compare_objs_lex<K>());
std::vector<T> f;
f.push_back(impl::new_vector(p[0]));
......
......@@ -4,7 +4,7 @@
#include <Eigen/Core>
namespace limbo {
namespace init_fun {
namespace init {
// params:
// -init::nb_bins
template <typename Params>
......
#ifndef INITIALIZATION_FUNCTIONS_HPP_
#define INITIALIZATION_FUNCTIONS_HPP_
#include <limbo/init_fun/no_init.hpp>
#include <limbo/init_fun/random_sampling.hpp>
#include <limbo/init_fun/random_sampling_grid.hpp>
#include <limbo/init_fun/grid_sampling.hpp>
#include <limbo/init/no_init.hpp>
#include <limbo/init/random_sampling.hpp>
#include <limbo/init/random_sampling_grid.hpp>
#include <limbo/init/grid_sampling.hpp>
#endif
......@@ -2,7 +2,7 @@
#define INITIALIZATION_FUNCTIONS_NO_INIT_HPP_
namespace limbo {
namespace init_fun {
namespace init {
// params is here only to make it easy to switch
// from/to the other init functions
template <typename Params>
......
......@@ -2,9 +2,10 @@
#define INITIALIZATION_FUNCTIONS_RANDOM_SAMPLING_HPP_
#include <Eigen/Core>
#include <limbo/tools/rand.hpp>
namespace limbo {
namespace init_fun {
namespace init {
// initialize in [0,1] !
// params: init::nb_samples
template <typename Params>
......@@ -15,7 +16,7 @@ namespace limbo {
for (int i = 0; i < Params::init::nb_samples(); i++) {
Eigen::VectorXd new_sample(F::dim_in);
for (int i = 0; i < F::dim_in; i++)
new_sample[i] = misc::rand<double>(0, 1);
new_sample[i] = tools::rand<double>(0, 1);
std::cout << "random sample:" << new_sample.transpose() << std::endl;
opt.add_new_sample(new_sample, feval(new_sample));
}
......
......@@ -4,7 +4,7 @@
#include <Eigen/Core>
namespace limbo {
namespace init_fun {
namespace init {
// initialize in [0,1] !
// params:
// -init::nb_bins
......
......@@ -12,7 +12,7 @@
#include <cmaes/cmaes_interface.h>
#include <cmaes/boundary_transformation.h>
#include <limbo/par/parallel.hpp>
#include <limbo/tools/parallel.hpp>
namespace limbo {
......@@ -77,7 +77,7 @@ namespace limbo {
while (!(stop = cmaes_TestForTermination(&evo))) {
pop = cmaes_SamplePopulation(&evo);
par::loop(0, pop_size, [&](int i) {
tools::par::loop(0, pop_size, [&](int i) {
// clang-format off
boundary_transformation(&boundaries, pop[i], all_x_in_bounds[i], dim_in);
for (int j = 0; j < dim_in; ++j)
......
......@@ -4,7 +4,7 @@
#include <Eigen/Core>
namespace limbo {
namespace kernel_fun {
namespace kernel {
template <typename Params>
struct Exp {
Exp(size_t dim = 1) {}
......
#ifndef KERNEL_FUNCTIONS_HPP_
#define KERNEL_FUNCTIONS_HPP_
#include <limbo/kernel/exp.hpp>
#include <limbo/kernel/matern_three_halfs.hpp>
#include <limbo/kernel/matern_five_halfs.hpp>
#include <limbo/kernel/squared_exp_ard.hpp>
#endif
\ No newline at end of file
......@@ -4,7 +4,7 @@
#include <Eigen/Core>
namespace limbo {
namespace kernel_fun {
namespace kernel {
template <typename Params>
struct MaternFiveHalfs {
MaternFiveHalfs(size_t dim = 1) {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment