#include "semseg/classifier/FPCnone.h"

#include <iostream>

using namespace OBJREC;

using namespace std;

using namespace NICE;

FPCnone::FPCnone()
{
}

FPCnone::FPCnone( const Config *_conf, string section )
{
  conf = _conf;
}

FPCnone::~FPCnone()
{
  //clean up
}

ClassificationResult FPCnone::classify( Example & pce )
{
  FullVector overall_distribution( maxClassNo + 1 );
  overall_distribution[maxClassNo] = 0.0;

  double maxp = -numeric_limits<double>::max();
  int classno = 0;

  double sum  = 0.0;

  for ( int i = 0; i < maxClassNo + 1; i++ )
  {
    overall_distribution[i] = ( *pce.vec )[i];

    sum += overall_distribution[i];

    if ( maxp < overall_distribution[i] )
    {
      classno = i;
      maxp = overall_distribution[i];
    }
  }

  /*for(int i = 0; i < maxClassNo; i++)
  {
   overall_distribution[i] /= sum;
  }*/

  //cout << "Klasse: " << classno << " prob: " << overall_distribution[classno] << endl;
  if ( classno > 12 )
  {
    cout << "failure" << endl;
  }

  return ClassificationResult( classno, overall_distribution );
}

void FPCnone::train( FeaturePool & _fp, Examples & examples )
{
  fp = FeaturePool( _fp );
}


void FPCnone::restore( istream & is, int format )
{
}

void FPCnone::store( ostream & os, int format ) const
{
}

void FPCnone::clear()
{
}

FeaturePoolClassifier *FPCnone::clone() const
{
  FPCnone *o = new FPCnone( conf, "non" );

  o->maxClassNo = maxClassNo;

  return o;
}

void FPCnone::setComplexity( int size )
{
  cerr << "FPCnone: no complexity to set" << endl;
}