ClassificationResult.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * @file ClassificationResult.h
  3. * @brief classification result data (probabilities, most probable class, rejection status, ...)
  4. * @author Erik Rodner
  5. * @date 02/13/2008
  6. */
  7. #ifndef CLASSIFICATIONRESULTINCLUDE
  8. #define CLASSIFICATIONRESULTINCLUDE
  9. #include "core/image/ImageT.h"
  10. #include "core/vector/VectorT.h"
  11. #include "core/vector/MatrixT.h"
  12. #include <string>
  13. #include <map>
  14. #include "core/vector/SparseVectorT.h"
  15. #include "vislearning/math/mathbase/FullVector.h"
  16. namespace OBJREC {
  17. /** @brief classification result data (probabilities, most probable class, rejection status, ...) */
  18. class ClassificationResult
  19. {
  20. public:
  21. /** rejection types */
  22. enum {
  23. REJECTION_FEATURE = 0,
  24. REJECTION_CLASSIFIER,
  25. REJECTION_MISC,
  26. REJECTION_NONE,
  27. REJECTION_UNINTIALIZED
  28. };
  29. /** rejection status (selected from enum) */
  30. int rejection_status;
  31. /** std::vector consisting of scores for each class
  32. @remark no guaranteed probabilities
  33. low scores means low probability for this class
  34. */
  35. FullVector scores;
  36. /** most important part: class number of classification result,
  37. most probable class */
  38. int classno;
  39. /** evil workaround: ground truth class number (useful within ClassificationResults)
  40. @see testClassification.cpp
  41. @see ClassificationResults
  42. */
  43. int classno_groundtruth;
  44. /** text representation of the most probable class
  45. @remark has to be set manually !! */
  46. std::string classname;
  47. /** uncertainty of the estimate, only available for GP classifiers */
  48. double uncertainty;
  49. /** simple constructor, create rejected result */
  50. ClassificationResult ( int rejection_status = REJECTION_UNINTIALIZED, int maxClassNo = 0 );
  51. /** result of classification only consists of the most probable
  52. class @p classno and a score of this assigment */
  53. ClassificationResult ( int classno, double score, int maxClassNo );
  54. /** result of classification consists of most probable class @p classno
  55. and a score for each of the other classes */
  56. ClassificationResult ( int classno, const FullVector & scores );
  57. /** result of classification consists of most probable class @p classno
  58. and a (sparse) score for each of the other classes */
  59. ClassificationResult ( int _classno,
  60. const NICE::SparseVector & _scores
  61. );
  62. /** simple destructor */
  63. virtual ~ClassificationResult();
  64. /** was it rejected ? */
  65. bool ok () const;
  66. /** probability of predicted class */
  67. double confidence () const;
  68. };
  69. } // namespace
  70. #endif