PLearn 0.1
|
Does elementwise newx_i = (x_i>=threshold ?truevalue :falsevalue);. More...
#include <IsAboveThresholdVariable.h>
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 OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual IsAboveThresholdVariable * | 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 | |
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 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 |
real | truevalue |
real | falsevalue |
bool | strict |
Private Types | |
typedef UnaryVariable | inherited |
Does elementwise newx_i = (x_i>=threshold ?truevalue :falsevalue);.
Definition at line 55 of file IsAboveThresholdVariable.h.
typedef UnaryVariable PLearn::IsAboveThresholdVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 57 of file IsAboveThresholdVariable.h.
PLearn::IsAboveThresholdVariable::IsAboveThresholdVariable | ( | ) | [inline] |
Default constructor for persistence.
Definition at line 65 of file IsAboveThresholdVariable.h.
: threshold(), truevalue(), falsevalue() {}
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.
string PLearn::IsAboveThresholdVariable::_classname_ | ( | ) | [static] |
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.
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); }
ol | List 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.
{ declareOption(ol, "threshold", &IsAboveThresholdVariable::threshold, OptionBase::buildoption, ""); declareOption(ol, "truevalue", &IsAboveThresholdVariable::truevalue, OptionBase::buildoption, ""); declareOption(ol, "falsevalue", &IsAboveThresholdVariable::falsevalue, OptionBase::buildoption, ""); declareOption(ol, "strict", &IsAboveThresholdVariable::strict, OptionBase::buildoption, ""); inherited::declareOptions(ol); }
static const PPath& PLearn::IsAboveThresholdVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 68 of file IsAboveThresholdVariable.h.
{ return new IsAboveThresholdVariable(v,threshold,truevalue,falsevalue,strict); }
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.
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.
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().
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(); }
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.
{}
Reimplemented from PLearn::UnaryVariable.
Definition at line 68 of file IsAboveThresholdVariable.h.
real PLearn::IsAboveThresholdVariable::falsevalue [protected] |
Definition at line 60 of file IsAboveThresholdVariable.h.
Referenced by declareOptions(), and fprop().
bool PLearn::IsAboveThresholdVariable::strict [protected] |
Definition at line 61 of file IsAboveThresholdVariable.h.
Referenced by declareOptions(), and fprop().
real PLearn::IsAboveThresholdVariable::threshold [protected] |
Definition at line 60 of file IsAboveThresholdVariable.h.
Referenced by declareOptions(), and fprop().
real PLearn::IsAboveThresholdVariable::truevalue [protected] |
Definition at line 60 of file IsAboveThresholdVariable.h.
Referenced by declareOptions(), and fprop().