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

PLearn::ClassMarginCostFunction Class Reference

#include <ClassMarginCostFunction.h>

Inheritance diagram for PLearn::ClassMarginCostFunction:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ClassMarginCostFunction (bool the_binary_target_is_01=false, bool out_is_positive=false)
 PLEARN_DECLARE_OBJECT (ClassMarginCostFunction)
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)


Public Attributes

bool binary_target_is_01
bool output_is_positive

Static Protected Member Functions

void declareOptions (OptionList &ol)
 recognized option are "binary_target_is_01" and "output_is_positive"


Private Types

typedef Kernel inherited

Detailed Description

* If output and target both have length 1, when binary classification with targets -1 and +1 and the sign of the output is considered, then margin is output[0]*target[0] If binary targets is {0,1} and outputs>0, then the margin is: (output[0]+1)*(target[0]+1)/4 However, if the flag output_is_positive is true then output is replaced by output[0]-0.5 in the above expressions. 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). Then margin is the difference between the score of the correct class and the highest score among the other classes. If both output and target have a length>1 then output is understood as giving a score for each class while the correct class is given by argmax(target). Then margin is the difference between the score of the correct class and the highest score among the other classes. In all cases, as this is a cost function, we return -margin.

Definition at line 70 of file ClassMarginCostFunction.h.


Member Typedef Documentation

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

Reimplemented from PLearn::Kernel.

Definition at line 72 of file ClassMarginCostFunction.h.


Constructor & Destructor Documentation

PLearn::ClassMarginCostFunction::ClassMarginCostFunction bool  the_binary_target_is_01 = false,
bool  out_is_positive = false
[inline]
 

Definition at line 77 of file ClassMarginCostFunction.h.

References binary_target_is_01, and output_is_positive.


Member Function Documentation

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

recognized option are "binary_target_is_01" and "output_is_positive"

Reimplemented from PLearn::Kernel.

Definition at line 82 of file ClassMarginCostFunction.cc.

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

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

returns K(x1,x2)

Implements PLearn::Kernel.

Definition at line 51 of file ClassMarginCostFunction.cc.

References PLearn::argmax(), binary_target_is_01, PLearn::TVec< T >::length(), PLearn::max(), output_is_positive, and PLearn::Vec.

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

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

Reimplemented from PLearn::Object.

Definition at line 84 of file ClassMarginCostFunction.h.

PLearn::ClassMarginCostFunction::PLEARN_DECLARE_OBJECT ClassMarginCostFunction   ) 
 


Member Data Documentation

bool PLearn::ClassMarginCostFunction::binary_target_is_01
 

Definition at line 75 of file ClassMarginCostFunction.h.

Referenced by ClassMarginCostFunction(), and evaluate().

bool PLearn::ClassMarginCostFunction::output_is_positive
 

Definition at line 76 of file ClassMarginCostFunction.h.

Referenced by ClassMarginCostFunction(), and evaluate().


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