/**
* @file ClassificationResult.h
* @brief classification result data (probabilities, most probable class, rejection status, ...)
* @author Erik Rodner
* @date 02/13/2008

*/
#ifndef CLASSIFICATIONRESULTINCLUDE
#define CLASSIFICATIONRESULTINCLUDE

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

#include <string>
#include <map>
#include "core/vector/SparseVectorT.h"
#include "vislearning/math/mathbase/FullVector.h"


namespace OBJREC {

/** @brief classification result data (probabilities, most probable class, rejection status, ...) */
class ClassificationResult
{

  public:

    /** rejection types */
    enum {
      REJECTION_FEATURE = 0,
      REJECTION_CLASSIFIER,
      REJECTION_MISC,
      REJECTION_NONE,
      REJECTION_UNINTIALIZED
    };

    /** rejection status (selected from enum) */
    int rejection_status;

    /** std::vector consisting of scores for each class
        @remark no guaranteed probabilities
        low scores means low probability for this class
    */
    FullVector scores;

    /** most important part: class number of classification result,
        most probable class */
    int classno;

    /** evil workaround: ground truth class number (useful within ClassificationResults)
        @see testClassification.cpp
        @see ClassificationResults
    */
    int classno_groundtruth;

    /** text representation of the most probable class
        @remark has to be set manually !! */
    std::string classname;

    /** uncertainty of the estimate, only available for GP classifiers */
    double uncertainty;

    /** simple constructor, create rejected result */
    ClassificationResult ( int rejection_status = REJECTION_UNINTIALIZED, int maxClassNo = 0 );

    /** result of classification only consists of the most probable
        class @p classno and a score of this assigment */
    ClassificationResult ( int classno, double score, int maxClassNo );

    /** result of classification consists of most probable class @p classno
        and a score for each of the other classes */
    ClassificationResult ( int classno, const FullVector & scores );
    
    /** result of classification consists of most probable class @p classno
        and a (sparse) score for each of the other classes */
    ClassificationResult ( int _classno, 
                           const NICE::SparseVector & _scores 
                         );    

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

    /** was it rejected ? */
    bool ok () const;

    /** probability of predicted class */
    double confidence () const;
};

} // namespace

#endif