ClassificationResult.h 2.2 KB

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