Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::ClassErrorCostFunction Class Reference

#include <ClassErrorCostFunction.h>

Inheritance diagram for PLearn::ClassErrorCostFunction:

Inheritance graph
[legend]
Collaboration diagram for PLearn::ClassErrorCostFunction:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ClassErrorCostFunction (bool the_output_is_classnum=false)
 PLEARN_DECLARE_OBJECT (ClassErrorCostFunction)
virtual string info () const
 returns a bit more informative string about object (default returns classname())

virtual real evaluate (const Vec &output, const Vec &target) const
 returns K(x1,x2)


Static Protected Member Functions

void declareOptions (OptionList &ol)
 recognized option is "output_is_classnum"


Protected Attributes

bool output_is_classnum

Private Types

typedef Kernel inherited

Detailed Description

* If output and target both have length 1, then binary classification with targets -1 and +1 is assumed and the sign of the output is considered If output has length>1 and target has length 1, then output is understood as giving a score for each class while target is the index of the correct class (numbered from 0) If both output and target have a length>1 then then output is understood as giving a score for each class while the correct class is given by argmax(target) In any case, evaluation returns 0 if classification was correct, 1 otherwise

Definition at line 64 of file ClassErrorCostFunction.h.


Member Typedef Documentation

typedef Kernel PLearn::ClassErrorCostFunction::inherited [private]
 

Reimplemented from PLearn::Kernel.

Definition at line 66 of file ClassErrorCostFunction.h.


Constructor & Destructor Documentation

PLearn::ClassErrorCostFunction::ClassErrorCostFunction bool  the_output_is_classnum = false  )  [inline]
 

There are several cases: 1) target is a single value +1 or -1 , and output is a single value whose sign stands for the class 2) target is a single value in 0..n-1 indicating classnumber and output is a n-dimensional vector of scores 3) target is a n-dimensional vector whose argmax indicates the class, and output is a n-dimensional vector of scores 4) target is a single value indicating classnumber, and output is a single value indicating classnumber 5) target is a single value 0 or 1 , and output is a single value with the threshold 0.5 Cases 1,2,3 are handled correctly with the default output_is_classnum=false For case 4 and 5, you must specify output_is_classnum=true

Definition at line 81 of file ClassErrorCostFunction.h.

References output_is_classnum.


Member Function Documentation

void PLearn::ClassErrorCostFunction::declareOptions OptionList ol  )  [static, protected]
 

recognized option is "output_is_classnum"

Reimplemented from PLearn::Kernel.

Definition at line 85 of file ClassErrorCostFunction.cc.

References PLearn::declareOption(), and PLearn::OptionList.

real PLearn::ClassErrorCostFunction::evaluate const Vec output,
const Vec target
const [virtual]
 

returns K(x1,x2)

Implements PLearn::Kernel.

Definition at line 53 of file ClassErrorCostFunction.cc.

References PLearn::argmax(), PLearn::is_integer(), PLearn::TVec< T >::length(), output_is_classnum, and PLearn::Vec.

virtual string PLearn::ClassErrorCostFunction::info  )  const [inline, virtual]
 

returns a bit more informative string about object (default returns classname())

Reimplemented from PLearn::Object.

Definition at line 86 of file ClassErrorCostFunction.h.

PLearn::ClassErrorCostFunction::PLEARN_DECLARE_OBJECT ClassErrorCostFunction   ) 
 


Member Data Documentation

bool PLearn::ClassErrorCostFunction::output_is_classnum [protected]
 

Definition at line 69 of file ClassErrorCostFunction.h.

Referenced by ClassErrorCostFunction(), and evaluate().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:23:18 2004 for PLearn by doxygen 1.3.7