/**
* @file KCGPLaplace.h
* @brief Gaussian Process Regression for Classification
* @author Erik Rodner
* @date 12/03/2009

*/
#ifndef KCGPLAPLACEINCLUDE
#define KCGPLAPLACEINCLUDE

#include "vislearning/classifier/classifierbase/KernelClassifier.h"
#include "vislearning/math/kernels/ParameterizedKernel.h"
#include "vislearning/classifier/kernelclassifier/LaplaceApproximation.h"
#include "vislearning/classifier/kernelclassifier/LikelihoodFunction.h"

#undef ROADWORKS
#define ROADWORKS fthrow(NICE::Exception, "Persistent interface not implemented!");

namespace OBJREC
{

/** Gaussian Process Regression for Classification */
class KCGPLaplace : public KernelClassifier
{
  protected:

    enum
    {
      OPTIMIZATION_METHOD_RASMUSSEN = 0,
      OPTIMIZATION_METHOD_TRUSTREGION
    };


    int optimizationMethod;

    bool verbose;
    bool optimizeParameters;

    NICE::Vector y;

    LaplaceApproximation laplaceApproximation;
    LikelihoodFunction *likelihoodFunction;

  public:

    /** simple constructor */
    KCGPLaplace ( const NICE::Config *conf, Kernel *kernel = NULL, const std::string & section = "KCGPLaplace" );

    /** copy constructor */
    KCGPLaplace ( const KCGPLaplace & src );

    /** simple destructor */
    virtual ~KCGPLaplace();

    /** teach the classifier with a kernel matrix and the corresponding class labels @param y ! */
    void teach ( KernelData *kernelData, const NICE::Vector & y );

    /** classify an example by using its kernel values with the training set,
     be careful with the order in @param kernelVector */
    virtual ClassificationResult classifyKernel ( const NICE::Vector & kernelVector, double kernelSelf ) const;

    /** clone this object */
    KCGPLaplace *clone() const;

    void restore ( std::istream&, int )
    {
      ROADWORKS
    };
    void store ( std::ostream&, int ) const
    {
      ROADWORKS
    };
    void clear()
    {
      ROADWORKS
    };
};


}

#undef ROADWORKS

#endif
