BayesOpt
criteria_poi.hpp
Go to the documentation of this file.
1 
2 /*
3 -------------------------------------------------------------------------
4  This file is part of BayesOpt, an efficient C++ library for
5  Bayesian optimization.
6 
7  Copyright (C) 2011-2015 Ruben Martinez-Cantin <rmcantin@unizar.es>
8 
9  BayesOpt is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Affero General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  BayesOpt is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Affero General Public License for more details.
18 
19  You should have received a copy of the GNU Affero General Public License
20  along with BayesOpt. If not, see <http://www.gnu.org/licenses/>.
21 ------------------------------------------------------------------------
22 */
23 
24 #ifndef _CRITERIA_POI_HPP_
25 #define _CRITERIA_POI_HPP_
26 
27 #include "criteria_functors.hpp"
28 #include "prob_distribution.hpp"
29 
30 namespace bayesopt
31 {
32 
35  class ProbabilityOfImprovement: public Criteria
37  {
38  public:
39  virtual ~ProbabilityOfImprovement(){};
40  void init(NonParametricProcess* proc)
41  {
42  mProc = proc;
43  mEpsilon = 0.01;
44  };
45  void setParameters(const vectord &params)
46  { mEpsilon = params(0); };
47 
48  size_t nParameters() {return 1;};
49 
50  inline void setEpsilon(double eps) { mEpsilon = eps; };
51  double operator() (const vectord &x)
52  {
53  const double min = mProc->getValueAtMinimum();
54  return mProc->prediction(x)->negativeProbabilityOfImprovement(min,
55  mEpsilon);
56  };
57  std::string name() {return "cPOI";};
58  private:
59  double mEpsilon;
60  };
61 
63 
64 } //namespace bayesopt
65 
66 
67 #endif
virtual double negativeProbabilityOfImprovement(double yMin, double epsilon)=0
Probability of improvement algorithm for minimization.
Namespace of the library interface.
Definition: using.dox:1
Interface for probability models.
virtual ProbabilityDistribution * prediction(const vectord &query)=0
Function that returns the prediction of the GP for a query point in the hypercube [0...
Abstract and factory modules for criteria.