123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- /**
- * @file FPCGPHIK.h
- * @author Alexander Freytag, Erik Rodner
- * @date 02/01/2012
- */
- #ifndef _NICE_GPHIKCLASSIFIERNICEINCLUDE
- #define _NICE_GPHIKCLASSIFIERNICEINCLUDE
- #include <string>
- #include "core/basics/Config.h"
- #include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"
- #include <gp-hik-core/GPHIKClassifier.h>
- #include <gp-hik-core/FMKGPHyperparameterOptimization.h>
- #include <gp-hik-core/parameterizedFunctions/ParameterizedFunction.h>
- namespace OBJREC {
-
- /** @class FPCGPHIK
- * Wrapper class (feature pool interface) for our GP HIK classifier
- *
- * @author Alexander Freytag, Erik Rodner
- */
- class FPCGPHIK : public FeaturePoolClassifier
- {
- protected:
-
- NICE::GPHIKClassifier * classifier;
-
- /** verbose flag for useful output*/
- bool verbose;
-
- /** a simple balancing strategy: use only that many examples of each class, as the smallest class provides*/
- bool useSimpleBalancing;
- int minSamples;
-
- /** When adding new examples, do we want to run a whole optimization of all involved hyperparameters? default: true*/
- bool performOptimizationAfterIncrement;
- public:
- /** simple constructor */
- FPCGPHIK( const NICE::Config *conf, const std::string & confSection = "GPHIKClassifier" );
-
- /** simple destructor */
- virtual ~FPCGPHIK();
-
- /**
- * @brief classify a given example with the previously learnt model
- * @param pe example to be classified given in a sparse representation
- */
- virtual ClassificationResult classify ( OBJREC::Example & pe );
- /**
- * @brief classify a given example with the previously learnt model
- * @date 19-06-2012 (dd-mm-yyyy)
- * @author Alexander Freytag
- * @param examples example to be classified given in a sparse representation
- */
- ClassificationResult classify ( const NICE::SparseVector * example );
- /** training process */
- virtual void train ( OBJREC::FeaturePool & fp, OBJREC::Examples & examples );
- /**
- * @brief train this classifier using a given set of examples and a given set of binary label vectors
- * @date 19-06-2012 (dd-mm-yyyy)
- * @author Alexander Freytag
- * @param examples examples to use given in a sparse data structure
- * @param binLabels corresponding binary labels with class no. There is no need here that every examples has only on positive entry in this set (1,-1)
- */
- void train ( const std::vector< NICE::SparseVector *> & examples, std::map<int, NICE::Vector> & binLabels );
-
- /** Persistent interface */
- virtual void restore ( std::istream & is, int format = 0 );
- virtual void store ( std::ostream & os, int format = 0 ) const;
- virtual void clear ();
- virtual FeaturePoolClassifier *clone () const;
-
- /** prediction of classification uncertainty */
- void predictUncertainty( OBJREC::Example & pe, NICE::Vector & uncertainties );
- /**
- * @brief prediction of classification uncertainty
- * @date 19-06-2012 (dd-mm-yyyy)
- * @author Alexander Freytag
- * @param examples example for which the classification uncertainty shall be predicted, given in a sparse representation
- * @param uncertainties contains the resulting classification uncertainties (1 entry for standard setting, m entries for binary-balanced setting)
- */
- void predictUncertainty( const NICE::SparseVector * example, NICE::Vector & uncertainties );
-
- void addExample( const OBJREC::Example & pe, const double & label);
- virtual void addMultipleExamples( OBJREC::Examples & newExamples);
-
- };
- }
- #endif
|