PLearn 0.1
|
#include <CutAboveThresholdVariable.h>
Public Member Functions | |
CutAboveThresholdVariable () | |
Default constructor for persistence. | |
CutAboveThresholdVariable (Variable *input, real the_threshold) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual CutAboveThresholdVariable * | deepCopy (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_ () |
CutAboveThresholdVariable. | |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static Object * | _new_instance_for_typemap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
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 |
Definition at line 52 of file CutAboveThresholdVariable.h.
typedef UnaryVariable PLearn::CutAboveThresholdVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 54 of file CutAboveThresholdVariable.h.
PLearn::CutAboveThresholdVariable::CutAboveThresholdVariable | ( | ) | [inline] |
Default constructor for persistence.
Definition at line 61 of file CutAboveThresholdVariable.h.
: threshold() {}
string PLearn::CutAboveThresholdVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
OptionList & PLearn::CutAboveThresholdVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
RemoteMethodMap & PLearn::CutAboveThresholdVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
Object * PLearn::CutAboveThresholdVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
StaticInitializer CutAboveThresholdVariable::_static_initializer_ & PLearn::CutAboveThresholdVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
void PLearn::CutAboveThresholdVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 88 of file CutAboveThresholdVariable.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]; }
string PLearn::CutAboveThresholdVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
void PLearn::CutAboveThresholdVariable::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); }
ol | List of options that is progressively being constructed for the current class. |
Reimplemented from PLearn::UnaryVariable.
Definition at line 72 of file CutAboveThresholdVariable.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::UnaryVariable::declareOptions(), and threshold.
{ declareOption(ol, "threshold", &CutAboveThresholdVariable::threshold, OptionBase::buildoption, ""); inherited::declareOptions(ol); }
static const PPath& PLearn::CutAboveThresholdVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 64 of file CutAboveThresholdVariable.h.
{ return new CutAboveThresholdVariable(v,threshold); }
CutAboveThresholdVariable * PLearn::CutAboveThresholdVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
void PLearn::CutAboveThresholdVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 78 of file CutAboveThresholdVariable.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; } }
OptionList & PLearn::CutAboveThresholdVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
OptionMap & PLearn::CutAboveThresholdVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
RemoteMethodMap & PLearn::CutAboveThresholdVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file CutAboveThresholdVariable.cc.
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 CutAboveThresholdVariable.cc.
References PLearn::UnaryVariable::input, PLearn::Var::length(), and PLearn::Var::width().
void PLearn::CutAboveThresholdVariable::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 CutAboveThresholdVariable.cc.
References PLearn::Variable::g, PLearn::UnaryVariable::input, and threshold.
Reimplemented from PLearn::UnaryVariable.
Definition at line 64 of file CutAboveThresholdVariable.h.
real PLearn::CutAboveThresholdVariable::threshold [protected] |
Definition at line 57 of file CutAboveThresholdVariable.h.
Referenced by bprop(), declareOptions(), fprop(), and symbolicBprop().