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

Does elementwise newx_i = (x_i>=threshold ?truevalue :falsevalue);. More...

#include <IsAboveThresholdVariable.h>

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

List of all members.

Public Member Functions

 IsAboveThresholdVariable ()
 Default constructor for persistence.
 IsAboveThresholdVariable (Variable *input, real the_threshold, real the_truevalue, real the_falsevalue, bool strict=false)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual IsAboveThresholdVariabledeepCopy (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
virtual void rfprop ()

Static Public Member Functions

static string _classname_ ()
 IsAboveThresholdVariable.
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
real truevalue
real falsevalue
bool strict

Private Types

typedef UnaryVariable inherited

Detailed Description

Does elementwise newx_i = (x_i>=threshold ?truevalue :falsevalue);.

Definition at line 55 of file IsAboveThresholdVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file IsAboveThresholdVariable.h.


Constructor & Destructor Documentation

PLearn::IsAboveThresholdVariable::IsAboveThresholdVariable ( ) [inline]

Default constructor for persistence.

Definition at line 65 of file IsAboveThresholdVariable.h.

PLearn::IsAboveThresholdVariable::IsAboveThresholdVariable ( Variable input,
real  the_threshold,
real  the_truevalue,
real  the_falsevalue,
bool  strict = false 
)

Definition at line 55 of file IsAboveThresholdVariable.cc.

    : inherited(input, input->length(), input->width()),
      threshold(the_threshold), truevalue(the_truevalue), falsevalue(the_falsevalue), strict(the_strict)
{}

Member Function Documentation

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

IsAboveThresholdVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 98 of file IsAboveThresholdVariable.cc.

{}
string PLearn::IsAboveThresholdVariable::classname ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

void PLearn::IsAboveThresholdVariable::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 63 of file IsAboveThresholdVariable.cc.

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

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 68 of file IsAboveThresholdVariable.h.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 81 of file IsAboveThresholdVariable.cc.

References falsevalue, i, PLearn::UnaryVariable::input, strict, threshold, truevalue, and PLearn::Variable::valuedata.

{
    if (strict)
        for(int i=0; i<input->nelems(); i++)
            if(input->valuedata[i]>threshold)
                valuedata[i] = truevalue;
            else
                valuedata[i] = falsevalue;
    else
        for(int i=0; i<input->nelems(); i++)
            if(input->valuedata[i]>=threshold)
                valuedata[i] = truevalue;
            else
                valuedata[i] = falsevalue;
}
OptionList & PLearn::IsAboveThresholdVariable::getOptionList ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 53 of file IsAboveThresholdVariable.cc.

void PLearn::IsAboveThresholdVariable::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 72 of file IsAboveThresholdVariable.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::IsAboveThresholdVariable::rfprop ( ) [virtual]

Reimplemented from PLearn::Variable.

Definition at line 103 of file IsAboveThresholdVariable.cc.

References PLearn::TVec< T >::length(), PLearn::UnaryVariable::resizeRValue(), and PLearn::Variable::rValue.

{
    if (rValue.length()==0) resizeRValue();
}

Here is the call graph for this function:

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

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

Reimplemented from PLearn::Variable.

Definition at line 100 of file IsAboveThresholdVariable.cc.

{}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 68 of file IsAboveThresholdVariable.h.

Definition at line 60 of file IsAboveThresholdVariable.h.

Referenced by declareOptions(), and fprop().

Definition at line 61 of file IsAboveThresholdVariable.h.

Referenced by declareOptions(), and fprop().

Definition at line 60 of file IsAboveThresholdVariable.h.

Referenced by declareOptions(), and fprop().

Definition at line 60 of file IsAboveThresholdVariable.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