Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Adding filtering step. TODO: Bug in python
Browse files Browse the repository at this point in the history
  • Loading branch information
rmcantin committed Jan 13, 2018
1 parent ee8e5f9 commit 6ed8282
Show file tree
Hide file tree
Showing 13 changed files with 2,765 additions and 1,292 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ SET( BAYESOPT_SRCS
./src/bayesoptdisc.cpp
./src/bayesoptbase.cpp
./src/bopt_state.cpp
./src/robust_filtering.cpp
./src/posteriormodel.cpp
./src/posterior_fixed.cpp
./src/posterior_empirical.cpp
Expand Down
4 changes: 3 additions & 1 deletion include/bayesopt/bayesoptbase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace bayesopt {
class ProbabilityDistribution;
class Dataset;
class BOptState;
class RobustFiltering;

typedef boost::numeric::ublas::vector<double> vectord;
typedef boost::numeric::ublas::vector<int> vectori;
Expand Down Expand Up @@ -203,10 +204,11 @@ namespace bayesopt {

private:
boost::scoped_ptr<PosteriorModel> mModel;
boost::scoped_ptr<PosteriorModel> mRobustModel;
boost::scoped_ptr<RobustFiltering> mFilter;
double mYPrev;
size_t mCounterStuck;
bool mUseRobust;

private:

BayesOptBase();
Expand Down
5 changes: 5 additions & 0 deletions include/bayesopt/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ extern "C" {
char* crit_name; /**< Name of the criterion */
double crit_params[128]; /**< Criterion hyperparameters (if needed) */
size_t n_crit_params; /**< Number of criterion hyperparameters */

int filtering_startup;
int filtering_interval;
double up_margin;
double low_margin;
} bopt_params;

/*-----------------------------------------------------------*/
Expand Down
8 changes: 7 additions & 1 deletion include/bayesopt/parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ namespace bayesopt {

std::string crit_name; /**< Name of the criterion */
vectord crit_params; /**< Criterion hyperparameters (if needed) */


int filtering_startup;
int filtering_interval;
double up_margin;
double low_margin;


/*
* Class member functions
*/
Expand Down
2 changes: 1 addition & 1 deletion include/dataset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace bayesopt
inline void Dataset::addSample(const vectord &x, double y)
{
mX.push_back(x); utils::append(mY,y);
updateMinMax(mY.size()-1);
updateMinMax();
}

inline double Dataset::getSampleY(size_t index) const
Expand Down
6 changes: 3 additions & 3 deletions include/gauss_distribution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ namespace bayesopt
*/
double pdf(double x)
{
x = (x - mean_) / std_;
return boost::math::pdf(d_,x);
double xu = (x - mean_) / std_;
return boost::math::pdf(d_,xu);
};

double quantile(double p)
{
x = boost::math::quantile(d_,p);
double x = boost::math::quantile(d_,p);
return (x - mean_) / std_;
};

Expand Down
2 changes: 1 addition & 1 deletion include/posteriormodel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace bayesopt {
vectord getPointAtMinimum();

void plotDataset(TLogLevel level);
i

const Dataset* getData();
void setData(const Dataset* data);
void copyData(const Dataset* data);
Expand Down
6 changes: 3 additions & 3 deletions include/student_t_distribution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ namespace bayesopt
*/
double pdf(double x)
{
x = (x - mean_) / std_;
return boost::math::pdf(d_,x);
double xu = (x - mean_) / std_;
return boost::math::pdf(d_,xu);
};

double quantile(double p)
{
x = boost::math::quantile(d_,p);
double x = boost::math::quantile(d_,p);
return (x - mean_) / std_;
};

Expand Down
Loading

0 comments on commit 6ed8282

Please sign in to comment.