/**
* @file ClassificationResult.cpp
* @brief classification result, what else?
* @author Erik Rodner
* @date 02/13/2008

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

#include <iostream>

#include "vislearning/cbaselib/ClassificationResult.h"

using namespace OBJREC;

using namespace std;
using namespace NICE;



ClassificationResult::ClassificationResult ( int _rejection_status, int maxClassNo ) : scores ( maxClassNo + 1 )
{
  rejection_status = _rejection_status;
  classno = -1;
  classno_groundtruth = -1;
  classname = "rejected";
  uncertainty = 0.0;
}

ClassificationResult::ClassificationResult ( int _classno, double _score, int maxClassNo ) : scores ( maxClassNo + 1 )
{
  rejection_status = REJECTION_NONE;
  classno = _classno;
  scores[classno] = _score;
  classname = "unknown";
  classno_groundtruth = -1;
  uncertainty = 0.0;
}

ClassificationResult::ClassificationResult ( int _classno, 
                                             const FullVector & _scores 
                                           )
{
  this->rejection_status = REJECTION_NONE;
  this->classno = _classno;
  this->scores = _scores;
  this->classname = "unknown";
  this->classno_groundtruth = -1;
  this->uncertainty = 0.0;
}

ClassificationResult::ClassificationResult ( int _classno, 
                                             const SparseVector & _scores 
                                           )
{
  throw("No conversion from SparseVector to FullVector available. Aborting!");
  
  this->rejection_status = REJECTION_NONE;
  this->classno = _classno;  

  this->classname = "unknown";
  this->classno_groundtruth = -1;
  this->uncertainty = 0.0;
}

ClassificationResult::~ClassificationResult()
{
}

double ClassificationResult::confidence () const
{
  return scores.get ( classno );
}

bool ClassificationResult::ok () const
{
  return ( rejection_status == REJECTION_NONE );
}
