Commits

Ruben Martinez-Cantin committed 6cbbd43

Working on ML

Comments (0)

Files changed (3)

include/gaussian_process_ign.hpp

 #define  _GAUSSIAN_PROCESS_IGN_HPP_
 
 #include "gauss_distribution.hpp"
-#include "nonparametricprocess.hpp"
+#include "hierarchical_gaussian_process.hpp"
 
 namespace bayesopt
 {
    * \brief Gaussian process with normal-inverse-gamma hyperprior 
    *        on mean and signal variance parameters.
    */
-  class GaussianProcessIGN: public NonParametricProcess 
+  class GaussianProcessIGN: public HierarchicalGaussianProcess
   {
   public:
     GaussianProcessIGN(size_t dim, double noise, double alpha,
      * the parameters.
      * @return value negative log likelihood
      */
-    double negativeTotalLogLikelihood()
-    { //TODO: Implement
-      assert(false); };
+    //    double negativeTotalLogLikelihood()
+    //{ //TODO: Implement
+    //  assert(false); };
 
     /** 
      * \brief Computes the negative log likelihood and its gradient of

include/gaussian_process_ml.hpp

    */
   class GaussianProcessML: public HierarchicalGaussianProcess
   {
-    G
-  }
+    GaussianProcessML(size_t dim, double noise);
+    virtual ~GaussianProcessML();
+
+    /** 
+     * \brief Function that returns the prediction of the GP for a query point
+     * in the hypercube [0,1].
+     * 
+     * @param query in the hypercube [0,1] to evaluate the Gaussian process
+     * @return pointer to the probability distribution.
+     */	
+    ProbabilityDistribution* prediction(const vectord &query);
+
+  private:
+
+    /** 
+     * \brief Computes the negative log likelihood and its gradient of
+     * the data. In this case, it is equivalent to the
+     * negativeTotalLogLikelihood
+     * @return value negative log likelihood
+     */
+    double negativeLogLikelihood()
+    { return negativeTotalLogLikelihood(); };
+
+    /** 
+     * \brief Precompute some values of the prediction that do not depends on
+     * the query
+     * @return error code
+     */
+    int precomputePrediction();
+
+  private:
+    double mWML, mSigML;           //!< GP ML parameters
+
+    /// Precomputed GP prediction operations
+
+    GaussianDistribution* d_;      //!< Predictive distributions
+  };
 
   /**@}*/
 

src/gaussian_process_ign.cpp

 
   GaussianProcessIGN::GaussianProcessIGN(size_t dim, double noise, double alpha, 
 					 double beta, double delta):
-    NonParametricProcess(dim,noise),
+    HierarchicalGaussianProcess(dim,noise),
     mAlpha(alpha), mBeta (beta), mDelta2(delta)
   {
     d_ = new GaussianDistribution();