123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #include "objrec-froehlichexp/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;
- }
|