/**
* @file VCOneVsOne.h
* @brief one-vs.-one svm voting
* @author Erik Rodner
* @date 10/25/2007

*/
#ifndef VCOneVsOneINCLUDE
#define VCOneVsOneINCLUDE

#include "core/vector/VectorT.h"
#include "core/vector/MatrixT.h"

#include "vislearning/classifier/classifierbase/VecClassifier.h"
#include "core/basics/triplet.h"


namespace OBJREC
{

/** one-vs.-one svm voting */
class VCOneVsOne : public VecClassifier
{
  protected:

    VecClassifier *prototype;
    std::vector< NICE::triplet<int, int, VecClassifier *> > classifiers;
    bool use_weighted_voting;

  public:

    /** simple constructor */
    VCOneVsOne ( const NICE::Config *conf, VecClassifier *prototype );

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

    /** classify using simple vector */
    ClassificationResult classify ( const NICE::Vector & x ) const;

    /** classify using a simple vector */
    void teach ( const LabeledSetVector & teachSet );

    void finishTeaching();


    void read ( const std::string& s, int format = 0 );
    void save ( const std::string& s, int format = 0 ) const;

    void clear ()
    {
      classifiers.clear();
    };
    void store ( std::ostream & os, int format = 0 ) const;
    void restore ( std::istream & is, int format = 0 );
};


} // namespace

#endif