Commits

Ruben Martinez-Cantin  committed c209ea9

Adding optimum value to criterion update.

  • Participants
  • Parent commits 5a6c81b

Comments (0)

Files changed (10)

File include/criteria/criteria_ei.hpp

       const double min = mProc->getValueAtMinimum();
       return d_->negativeExpectedImprovement(min,mExp); 
     };
-    void update()
+    void update(const vectord &x) 
     {
       ++nCalls;
       if (nCalls % 10)

File include/criteria/criteria_lcb.hpp

       ProbabilityDistribution* d_ = mProc->prediction(x);
       return d_->lowerConfidenceBound(beta); 
     };
-    void update(){ ++nCalls; }
+    void update(const vectord &x) { ++nCalls; }
 
     std::string name() {return "cLCBa";};
   private:

File include/criteria/criteria_mi.hpp

       double sigma2 = d->getStd() * d->getStd();
       return mu + mSqAlpha * (sqrt(sigma2+mGamma) - sqrt(mGamma));
     };
-    void update()
+    void update(const vectord &x)
     {
+      ProbabilityDistribution* d = mProc->prediction(x);
+      double mu = d->getMean();
+      double sigma2 = d->getStd() * d->getStd();
       mGamma += sigma2; 
     }
     std::string name() {return "cMI";};

File include/criteria_functors.hpp

     virtual void pushCriteria(Criteria* crit){};
     virtual bool requireComparison(){ return false; };
     virtual void initialCriteria(){};
-    virtual void update(){};
+    virtual void update(const vectord &x){};
     virtual bool rotateCriteria(){return false;};
     virtual void pushResult(const vectord& prevResult){};
     virtual std::string getBestCriteria(vectord& best)

File include/posterior_empirical.hpp

     void updateSurrogateModel();
 
     double evaluateCriteria(const vectord& query);
-    void updateCriteria();
+    void updateCriteria(const vectord& query);
 
     bool criteriaRequiresComparison();
     void setFirstCriterium();
   inline double EmpiricalBayes::evaluateCriteria(const vectord& query)
   { return (*mCrit)(query); };
 
-  inline void EmpiricalBayes::updateCriteria()
-  { return mCrit->update(); };
+  inline void EmpiricalBayes::updateCriteria(const vectord& query)
+  { return mCrit->update(query); };
 
   inline bool EmpiricalBayes::criteriaRequiresComparison()
   {return mCrit->requireComparison(); };

File include/posterior_fixed.hpp

     void updateSurrogateModel();
 
     double evaluateCriteria(const vectord& query);
-    void updateCriteria();
+    void updateCriteria(const vectord& query);
 
     bool criteriaRequiresComparison();
     void setFirstCriterium();
   inline double PosteriorFixed::evaluateCriteria(const vectord& query)
   { return (*mCrit)(query); };
 
-  inline void PosteriorFixed::updateCriteria()
-  { return mCrit->update(); };
+  inline void PosteriorFixed::updateCriteria(const vectord& query)
+  { return mCrit->update(query); };
 
   inline bool PosteriorFixed::criteriaRequiresComparison()
   {return mCrit->requireComparison(); };

File include/posterior_mcmc.hpp

     void updateSurrogateModel();
 
     double evaluateCriteria(const vectord& query);
-    void updateCriteria();
+    void updateCriteria(const vectord& query);
 
     bool criteriaRequiresComparison();
     void setFirstCriterium();
     return sum/static_cast<double>(nParticles);
   };
 
-  inline void MCMCModel::updateCriteria()
+  inline void MCMCModel::updateCriteria(const vectord& query)
   { 
     for(CritVect::iterator it=mCrit.begin(); it != mCrit.end(); ++it)
       {
-	it->update(); 
+	it->update(query); 
       }
   };
 

File include/posteriormodel.hpp

     virtual void updateSurrogateModel() = 0;
 
     virtual double evaluateCriteria(const vectord& query) = 0;
-    virtual void updateCriteria() = 0;
+    virtual void updateCriteria(const vectord& query) = 0;
 
     virtual bool criteriaRequiresComparison() = 0;
     virtual void setFirstCriterium() = 0;

File python/demo_dimscaling.py

 params['kernel_hp_mean'] = [1]
 params['kernel_hp_std'] = [5]
 params['surr_name'] = "sStudentTProcessNIG"
+#params['crit_name'] = "cMI"
 
 dim = 20
 lb = np.ones((dim,))*0

File src/bayesoptbase.cpp

 	mModel->updateSurrogateModel();
       } 
     plotStepData(mCurrentIter,xNext,yNext);
-    mModel->updateCriteria();
+    mModel->updateCriteria(xNext);
     mCurrentIter++;
   }