PLearn 0.1
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Member Functions | Private Types | Private Member Functions
PLearn::BinaryClassificationLossVariable Class Reference

#include <BinaryClassificationLossVariable.h>

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

List of all members.

Public Member Functions

 BinaryClassificationLossVariable ()
 Default constructor for persistence.
 BinaryClassificationLossVariable (Variable *netout, Variable *classnum)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual
BinaryClassificationLossVariable
deepCopy (CopiesMap &copies) const
virtual void build ()
 Post-constructor.
virtual void recomputeSize (int &l, int &w) const
 Recomputes the length l and width w that this variable should have, according to its parent variables.
virtual void fprop ()
 compute output given input
virtual void bprop ()
 can't bprop through a hard classification error...

Static Public Member Functions

static string _classname_ ()
 BinaryClassificationLossVariable.
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
static Object_new_instance_for_typemap_ ()
static bool _isa_ (const Object *o)
static void _static_initialize_ ()
static const PPathdeclaringFile ()

Public Attributes

int class_1
int class_2
real threshold

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares this class' options.

Private Types

typedef BinaryVariable inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 53 of file BinaryClassificationLossVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file BinaryClassificationLossVariable.h.


Constructor & Destructor Documentation

PLearn::BinaryClassificationLossVariable::BinaryClassificationLossVariable ( )

Default constructor for persistence.

Definition at line 58 of file BinaryClassificationLossVariable.cc.

    : threshold(0.0)
{ }
PLearn::BinaryClassificationLossVariable::BinaryClassificationLossVariable ( Variable netout,
Variable classnum 
)

Definition at line 71 of file BinaryClassificationLossVariable.cc.

References build_().

    : inherited(netout,classnum,1,1),
      class_1(0),
      class_2(1),
      threshold(0.5)
{
    build_();
}

Here is the call graph for this function:


Member Function Documentation

string PLearn::BinaryClassificationLossVariable::_classname_ ( ) [static]
OptionList & PLearn::BinaryClassificationLossVariable::_getOptionList_ ( ) [static]

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file BinaryClassificationLossVariable.cc.

RemoteMethodMap & PLearn::BinaryClassificationLossVariable::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file BinaryClassificationLossVariable.cc.

bool PLearn::BinaryClassificationLossVariable::_isa_ ( const Object o) [static]

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file BinaryClassificationLossVariable.cc.

Object * PLearn::BinaryClassificationLossVariable::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 55 of file BinaryClassificationLossVariable.cc.

StaticInitializer BinaryClassificationLossVariable::_static_initializer_ & PLearn::BinaryClassificationLossVariable::_static_initialize_ ( ) [static]

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file BinaryClassificationLossVariable.cc.

virtual void PLearn::BinaryClassificationLossVariable::bprop ( ) [inline, virtual]

can't bprop through a hard classification error...

Implements PLearn::Variable.

Definition at line 73 of file BinaryClassificationLossVariable.h.

{}
void PLearn::BinaryClassificationLossVariable::build ( ) [virtual]

Post-constructor.

The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.

Reimplemented from PLearn::BinaryVariable.

Definition at line 81 of file BinaryClassificationLossVariable.cc.

References PLearn::BinaryVariable::build(), and build_().

Here is the call graph for this function:

void PLearn::BinaryClassificationLossVariable::build_ ( ) [private]

This does the actual building.

Reimplemented from PLearn::BinaryVariable.

Definition at line 88 of file BinaryClassificationLossVariable.cc.

References PLearn::BinaryVariable::input2, and PLERROR.

Referenced by BinaryClassificationLossVariable(), and build().

{
    // input2 == classnum from constructor
    if (input2 && !input2->isScalar())
        PLERROR("In BinaryClassificationLossVariable: classnum must be a scalar variable representing an index of netout (typically a class number)");
}

Here is the caller graph for this function:

string PLearn::BinaryClassificationLossVariable::classname ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 55 of file BinaryClassificationLossVariable.cc.

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

Declares this class' options.

Reimplemented from PLearn::BinaryVariable.

Definition at line 65 of file BinaryClassificationLossVariable.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::BinaryVariable::declareOptions(), and threshold.

                                                                    {
    declareOption(ol, "threshold", &BinaryClassificationLossVariable::threshold, OptionBase::buildoption,
                  "The threshold under which the class is 'class_1', and above which the class is 'class_2'.");
    inherited::declareOptions(ol);
}

Here is the call graph for this function:

static const PPath& PLearn::BinaryClassificationLossVariable::declaringFile ( ) [inline, static]

Reimplemented from PLearn::BinaryVariable.

Definition at line 66 of file BinaryClassificationLossVariable.h.

{}
BinaryClassificationLossVariable * PLearn::BinaryClassificationLossVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::BinaryVariable.

Definition at line 55 of file BinaryClassificationLossVariable.cc.

void PLearn::BinaryClassificationLossVariable::fprop ( ) [virtual]

compute output given input

Implements PLearn::Variable.

Definition at line 99 of file BinaryClassificationLossVariable.cc.

References class_1, class_2, PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, threshold, and PLearn::Variable::valuedata.

{
    int classnum = int(input2->valuedata[0]);
    int outputclass;
    if (input1->valuedata[0] < threshold) {
        outputclass = class_1;
    } else {
        outputclass = class_2;
    }
  
    valuedata[0] = (outputclass == classnum ?0 :1);
}
OptionList & PLearn::BinaryClassificationLossVariable::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 55 of file BinaryClassificationLossVariable.cc.

OptionMap & PLearn::BinaryClassificationLossVariable::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 55 of file BinaryClassificationLossVariable.cc.

RemoteMethodMap & PLearn::BinaryClassificationLossVariable::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 55 of file BinaryClassificationLossVariable.cc.

void PLearn::BinaryClassificationLossVariable::recomputeSize ( int l,
int w 
) const [virtual]

Recomputes the length l and width w that this variable should have, according to its parent variables.

This is used for ex. by sizeprop() The default version stupidly returns the current dimensions, so make sure to overload it in subclasses if this is not appropriate.

Reimplemented from PLearn::Variable.

Definition at line 95 of file BinaryClassificationLossVariable.cc.

{ l=1, w=1; }

Member Data Documentation

Reimplemented from PLearn::BinaryVariable.

Definition at line 66 of file BinaryClassificationLossVariable.h.

Definition at line 59 of file BinaryClassificationLossVariable.h.

Referenced by fprop().

Definition at line 59 of file BinaryClassificationLossVariable.h.

Referenced by fprop().

Definition at line 60 of file BinaryClassificationLossVariable.h.

Referenced by declareOptions(), and fprop().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines