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

#include <CutBelowThresholdVariable.h>

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

List of all members.

Public Member Functions

 CutBelowThresholdVariable ()
 Default constructor for persistence.
 CutBelowThresholdVariable (Variable *input, real the_threshold)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual CutBelowThresholdVariabledeepCopy (CopiesMap &copies) const
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 ()
 Nothing to do by default.
virtual void bprop ()
 Nothing to do by default.
virtual void symbolicBprop ()
 compute a piece of new Var graph that represents the symbolic derivative of this Var

Static Public Member Functions

static string _classname_ ()
 CutBelowThresholdVariable.
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 ()
static void declareOptions (OptionList &ol)
 Declare options (data fields) for the class.

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Attributes

real threshold

Private Types

typedef UnaryVariable inherited

Detailed Description

Definition at line 52 of file CutBelowThresholdVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file CutBelowThresholdVariable.h.


Constructor & Destructor Documentation

PLearn::CutBelowThresholdVariable::CutBelowThresholdVariable ( ) [inline]

Default constructor for persistence.

Definition at line 61 of file CutBelowThresholdVariable.h.

: threshold() {}
PLearn::CutBelowThresholdVariable::CutBelowThresholdVariable ( Variable input,
real  the_threshold 
)

Definition at line 57 of file CutBelowThresholdVariable.cc.

    : inherited(input, input->length(), input->width()), threshold(the_threshold) 
{}

Member Function Documentation

string PLearn::CutBelowThresholdVariable::_classname_ ( ) [static]

CutBelowThresholdVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

OptionList & PLearn::CutBelowThresholdVariable::_getOptionList_ ( ) [static]

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

void PLearn::CutBelowThresholdVariable::bprop ( ) [virtual]

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 88 of file CutBelowThresholdVariable.cc.

References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, PLearn::Variable::nelems(), and threshold.

{
    for(int i=0; i<nelems(); i++)
        if(input->valuedata[i]>=threshold)        
            input->gradientdata[i] += gradientdata[i];
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

void PLearn::CutBelowThresholdVariable::declareOptions ( OptionList ol) [static]

Declare options (data fields) for the class.

Redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options). Please call the inherited method AT THE END to get the options listed in a consistent order (from most recently defined to least recently defined).

  static void MyDerivedClass::declareOptions(OptionList& ol)
  {
      declareOption(ol, "inputsize", &MyObject::inputsize_,
                    OptionBase::buildoption,
                    "The size of the input; it must be provided");
      declareOption(ol, "weights", &MyObject::weights,
                    OptionBase::learntoption,
                    "The learned model weights");
      inherited::declareOptions(ol);
  }
Parameters:
olList of options that is progressively being constructed for the current class.

Reimplemented from PLearn::UnaryVariable.

Definition at line 72 of file CutBelowThresholdVariable.cc.

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

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 64 of file CutBelowThresholdVariable.h.

CutBelowThresholdVariable * PLearn::CutBelowThresholdVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 78 of file CutBelowThresholdVariable.cc.

References i, PLearn::UnaryVariable::input, PLearn::Variable::nelems(), threshold, and PLearn::Variable::valuedata.

{
    for(int i=0; i<nelems(); i++)
    {
        real val = input->valuedata[i];
        valuedata[i] = val<threshold ?threshold :val;
    }
}

Here is the call graph for this function:

OptionList & PLearn::CutBelowThresholdVariable::getOptionList ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 55 of file CutBelowThresholdVariable.cc.

void PLearn::CutBelowThresholdVariable::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 62 of file CutBelowThresholdVariable.cc.

References PLearn::UnaryVariable::input, PLearn::Var::length(), and PLearn::Var::width().

{
    if (input) {
        l = input->length();
        w = input->width();
    } else
        l = w = 0;
}

Here is the call graph for this function:

void PLearn::CutBelowThresholdVariable::symbolicBprop ( ) [virtual]

compute a piece of new Var graph that represents the symbolic derivative of this Var

Reimplemented from PLearn::Variable.

Definition at line 96 of file CutBelowThresholdVariable.cc.

References PLearn::Variable::g, PLearn::UnaryVariable::input, and threshold.

{
    input->accg(g * (input>=threshold));
}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 64 of file CutBelowThresholdVariable.h.

Definition at line 57 of file CutBelowThresholdVariable.h.

Referenced by bprop(), declareOptions(), fprop(), and symbolicBprop().


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