/** 
* @file VCSVMOneClass.cpp
* @brief One-Class SVM Using C-SVM implementation of T. Joachims (SVM-light)
* @author Erik Rodner + Mi.Ke.
* @date 12/03/2010

*/
#ifndef VCSVMONECLASSINCLUDE
#define VCSVMONECLASSINCLUDE

#ifdef NICE_USELIB_SVMLIGHT

#include <vislearning/nice.h>

extern "C" {
#include <svm_common.h>
#include <svm_learn.h>
}

#include "vislearning/cbaselib/LabeledSet.h"
#include "vislearning/classifier/classifierbase/VecClassifier.h"
#include "vislearning/classifier/vclassifier/VCSVMLight.h"
#include "VCLogisticRegression.h"


namespace OBJREC {

/** Interface to SVMLight from T. Joachims */
class VCSVMOneClass : public VecClassifier
{

    protected:

		VCSVMLight *svm;

    public:
		/** using a config file to read some settings */
		VCSVMOneClass( const NICE::Config *conf, const std::string & section = "VCSVMLight" );

		/** simple copy constructor */
		VCSVMOneClass ( const VCSVMOneClass & src );
	  
		/** simple destructor */
		virtual ~VCSVMOneClass();
		 
		/** classify using simple vector */
		ClassificationResult classify ( const NICE::Vector & x ) const;

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

		/** clone this object */
		virtual VCSVMOneClass *clone(void) const;

		void clear ();

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

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


} // namespace

#endif
#endif
