/**
* @file KCGPLaplaceOneVsAll.h
* @author Erik Rodner
* @date 12/10/2009

*/
#ifndef _NICE_OBJREC_KCGPLAPLACEONEVSALLINCLUDE
#define _NICE_OBJREC_KCGPLAPLACEONEVSALLINCLUDE

#include <vector>

#include "vislearning/classifier/classifierbase/KernelClassifier.h"
#include "vislearning/classifier/kernelclassifier/KCGPLaplace.h"
#include "vislearning/classifier/kernelclassifier/LaplaceApproximation.h"
#include "vislearning/regression/gpregression/modelselcrit/genericGPModelSelection.h"
#include "vislearning/classifier/kernelclassifier/LikelihoodFunction.h"

namespace OBJREC
{

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

/** @class KCGPLaplaceOneVsAll
 * One vs. All GP Laplace classifier with joint optimization
 * of kernel parameters
 *
 * @author Erik Rodner
 */
class KCGPLaplaceOneVsAll : public KernelClassifier
{

  protected:
    NICE::Config confCopy;
    std::string confSection;

    bool optimizeParameters;

    bool verbose;

    int maxIterations;

    std::vector<LaplaceApproximation *> laplaceApproximations;
    LikelihoodFunction *likelihoodFunction;

    NICE::VVector ySetZeroMean;
    NICE::VectorT<int> classnos;

    //GPMSCLooLikelihoodRegression *modelselcrit;

    bool useLooParameters;

  public:

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

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

    /** 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 */
    ClassificationResult classifyKernel ( const NICE::Vector & kernelVector, double kernelSelf ) const;

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

};

#undef ROADWORKS

}

#endif
