/** 
* @file KCGPApproxOneClass.h
* @brief One-Class Gaussian Process Regression for Classification: we approximate the inverse of the regularized kernel matrix using a diagonal matrix
* @author Alexander Lütz
* @date 22-05-2012 (dd-mm-yyyy)

*/
#ifndef KCGPAPPROXONECLASSINCLUDE
#define KCGPAPPROXONECLASSINCLUDE

#include "vislearning/cbaselib/ClassificationResult.h"

#include "vislearning/classifier/classifierbase/KernelClassifier.h"

#include "vislearning/math/kernels/Kernel.h"


#define VARIANCE_DETECTION_MODE 1
#define MEAN_DETECTION_MODE 2

namespace OBJREC {
 
  class KCGPApproxOneClass : public KernelClassifier
  {

      protected:
        NICE::Vector matrixDInv;
        NICE::Vector InvDY;
        int mode;
        double staticNoise;
      

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

        /** copy constructor */
        KCGPApproxOneClass( const KCGPApproxOneClass & src );
            
        /** simple destructor */
        virtual ~KCGPApproxOneClass();
          
        /** teach the classifier with a kernel matrix and the corresponding class labels @param y ! */
        void teach ( KernelData *kernelData, const NICE::Vector & y );
        
        void teach (const LabeledSetVector &teachSet);
          
        /** 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 */
        KCGPApproxOneClass *clone() const;

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

  };

}

#endif