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

*/
#ifndef KCMINIMUMENCLOSINGBALLINCLUDE
#define KCMINIMUMENCLOSINGBALLINCLUDE

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

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

#define VARIANCE_DETECTION_MODE 1
#define MEAN_DETECTION_MODE 2

#include "vislearning/optimization/quadprog/QuadProg++.h"
#include "vislearning/optimization/quadprog/Array.h"


namespace OBJREC
{

/** Minimum Enclosing Ball Algorithm (For stationary kernels equal to 1-SVM)*/
class KCMinimumEnclosingBall : public KernelClassifier
{

  protected:
    int trainingSize;
    double radius;
    double aKa;
    double nu;
    QuadProgPP::Matrix<double> TwoK,Eye,Ones,ones;
    QuadProgPP::Vector<double> alpha,b,minusDiagK,minusOne,zeros;

  public:

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

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

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

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

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

};


}

#undef ROADWORKS

#endif
