/** 
* @file FPCFullSearch.h
* @brief optimal feature search like performed by boosting
* @author Erik Rodner
* @date 11/21/2008

*/
#ifndef FPCFullSearchINCLUDE
#define FPCFullSearchINCLUDE

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

#include <set>

#include "core/basics/Config.h"
#include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"

namespace OBJREC {

/** @brief optimal feature search like performed by boosting
    (use this class in conjunction with FPCBoosting as a weak classifier type) */
class FPCFullSearch : public FeaturePoolClassifier
{
    protected:
	/** stored config for persistence routines */
	const NICE::Config *conf;

	double alpha;
	double beta;

	bool use_regression;

    public:
	/** @{ */
	    /** hypotheses \f$h(x) = sign( p \cdot f(x) < p \cdot \f$
	    */

	    /** @brief single feature used for the classification decision \f$ f(x) \f$ */
	    Feature *f;

	    /** @brief corresponding feature threshold \f$ T \f$ */
	    double threshold;

	    /** @brief parity of the comparision \f$ p \f$ */
	    int parity;
	/** @} */

	
    public:
	/** DEBUG */
	double last_error;

	/** simple constructor */
	FPCFullSearch( const NICE::Config *conf );

	/** simple destructor */
	virtual ~FPCFullSearch();
    
	ClassificationResult classify ( Example & pe );

	void train ( FeaturePool & fp, Examples & examples );

	FPCFullSearch *clone () const;

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

	const Feature *getStump ( double & threshold, double & parity ) const;
};


} // namespace

#endif
