/**
* @file KCGPOneClass.h
* @brief One-Class Gaussian Process Regression for Classification
* @author Erik Rodner + Mi.Ke.
* @date 12/03/2010

*/
#ifndef KCGPONECLASSINCLUDE
#define KCGPONECLASSINCLUDE

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

#include "vislearning/regression/regressionbase/RegressionAlgorithmKernel.h"

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

#define VARIANCE_DETECTION_MODE 1
#define MEAN_DETECTION_MODE 2

namespace OBJREC
{

/** Gaussian Process Regression for One-Class Classification  (actually same as binary, don't use parameter optimization!!!)*/
class KCGPOneClass : public KernelClassifier
{

  protected:
    RegressionAlgorithmKernel *regressionAlgorithm;
    NICE::Matrix InverseKernelMatrix; //only used when 'variance mode' is used and computeInverse=true
    KernelData *kernelData; ////only used when 'variance mode' is used and computeInverse=false
    NICE::Vector y;
    int mode;
    bool computeInverse;
    double staticNoise;

  public:

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

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

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

    /** 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 */
    KCGPOneClass *clone() const;

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


}

#undef ROADWORKS

#endif