![]() |
GURLS++
2.0.00
C++ Implementation of GURLS Matlab Toolbox
|
ConfGap is the sub-class of Confidence that computes a confidence estimation for the predicted class.
#include <gap.h>
Public Member Functions | |
GurlsOptionsList * | execute (const gMat2D< T > &X, const gMat2D< T > &Y, const GurlsOptionsList &opt) throw (gException) |
Computes a confidence estimation for the predicted class (i.e. | |
Static Public Member Functions | |
static Confidence< T > * | factory (const std::string &id) throw (BadConfidenceCreation) |
Factory function returning a pointer to the newly created object. |
GurlsOptionsList * gurls::ConfGap< T >::execute | ( | const gMat2D< T > & | X, |
const gMat2D< T > & | Y, | ||
const GurlsOptionsList & | opt | ||
) | throw (gException) [virtual] |
highest scoring class). The difference between the highest scoring class and the second highest scoring class is used as an estimate.
X | not used |
Y | not used |
opt | options with the following:
|
Implements gurls::Confidence< T >.
Definition at line 76 of file gap.h.
{ // out = struct; // [n,k] = size(opt.pred); const gMat2D<T> &pred = opt.getOptValue<OptMatrix<gMat2D<T> > >("pred"); const unsigned long n = pred.rows(); const unsigned long t = pred.cols(); // out.confidence = opt.pred; // out.confidence = sort(out.confidence,2,'descend'); // out.confidence = out.confidence(:,1) - out.confidence(:,2); const T* expscores = pred.getData(); gMat2D<T> *conf = new gMat2D<T>(n,1); T* confidence = conf->getData(); T* rowT = new T[t]; for(unsigned long i=0; i<n; ++i) { getRow(expscores, n, t, i, rowT); std::sort(rowT,rowT+t); confidence[i] = rowT[t-1]-rowT[t-2]; } delete [] rowT; GurlsOptionsList* ret = new GurlsOptionsList("confidence"); ret->addOpt("confidence", new OptMatrix<gMat2D<T> >(*conf)); return ret; }
static Confidence<T>* gurls::Confidence< T >::factory | ( | const std::string & | id | ) | throw (BadConfidenceCreation) [inline, static, inherited] |
Definition at line 105 of file confidence.h.
{ if(id == "boltzman") return new ConfBoltzman<T>; if(id == "boltzmangap") return new ConfBoltzmanGap<T>; if(id == "gap") return new ConfGap<T>; if(id == "maxscore") return new ConfMaxScore<T>; throw BadConfidenceCreation(id); }