PLearn 0.1
|
#include <ConfRatedAdaboostCostVariable.h>
Public Member Functions | |
ConfRatedAdaboostCostVariable () | |
Default constructor for persistence. | |
ConfRatedAdaboostCostVariable (Variable *output, Variable *target, Variable *alpha) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual ConfRatedAdaboostCostVariable * | 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 () |
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_ () |
ConfRatedAdaboostCostVariable. | |
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) |
Default constructor for persistence. | |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Member Functions | |
void | build_ () |
Object-specific post-constructor. | |
Private Types | |
typedef NaryVariable | inherited |
Definition at line 51 of file ConfRatedAdaboostCostVariable.h.
typedef NaryVariable PLearn::ConfRatedAdaboostCostVariable::inherited [private] |
Reimplemented from PLearn::NaryVariable.
Definition at line 53 of file ConfRatedAdaboostCostVariable.h.
PLearn::ConfRatedAdaboostCostVariable::ConfRatedAdaboostCostVariable | ( | ) | [inline] |
Default constructor for persistence.
Definition at line 57 of file ConfRatedAdaboostCostVariable.h.
{}
string PLearn::ConfRatedAdaboostCostVariable::_classname_ | ( | ) | [static] |
ConfRatedAdaboostCostVariable.
Reimplemented from PLearn::NaryVariable.
Definition at line 55 of file ConfRatedAdaboostCostVariable.cc.
OptionList & PLearn::ConfRatedAdaboostCostVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::NaryVariable.
Definition at line 55 of file ConfRatedAdaboostCostVariable.cc.
RemoteMethodMap & PLearn::ConfRatedAdaboostCostVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::NaryVariable.
Definition at line 55 of file ConfRatedAdaboostCostVariable.cc.
Reimplemented from PLearn::NaryVariable.
Definition at line 55 of file ConfRatedAdaboostCostVariable.cc.
Object * PLearn::ConfRatedAdaboostCostVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Definition at line 55 of file ConfRatedAdaboostCostVariable.cc.
StaticInitializer ConfRatedAdaboostCostVariable::_static_initializer_ & PLearn::ConfRatedAdaboostCostVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::NaryVariable.
Definition at line 55 of file ConfRatedAdaboostCostVariable.cc.
void PLearn::ConfRatedAdaboostCostVariable::bprop | ( | ) | [virtual] |
Implements PLearn::Variable.
Definition at line 112 of file ConfRatedAdaboostCostVariable.cc.
References PLearn::Variable::gradientdata, i, PLearn::Variable::length(), PLearn::Variable::valuedata, and PLearn::NaryVariable::varray.
{ for(int i=0; i<length(); i++) { varray[0]->gradientdata[i] += -2*gradientdata[i]*valuedata[i]*varray[2]->valuedata[0]*(2*int(varray[1]->valuedata[i])-1); varray[2]->gradientdata[0] += -gradientdata[i]*valuedata[i]*(2*varray[0]->valuedata[i]-1)*(2*int(varray[1]->valuedata[i])-1); } }
void PLearn::ConfRatedAdaboostCostVariable::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::NaryVariable.
Definition at line 67 of file ConfRatedAdaboostCostVariable.cc.
References PLearn::NaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::ConfRatedAdaboostCostVariable::build_ | ( | ) | [protected] |
Object-specific post-constructor.
This method should be redefined in subclasses and do the actual building of the object according to previously set option fields. Constructors can just set option fields, and then call build_. This method is NOT virtual, and will typically be called only from three places: a constructor, the public virtual build()
method, and possibly the public virtual read method (which calls its parent's read). build_()
can assume that its parent's build_()
has already been called.
Reimplemented from PLearn::NaryVariable.
Definition at line 74 of file ConfRatedAdaboostCostVariable.cc.
References PLERROR, PLearn::Variable::size(), and PLearn::NaryVariable::varray.
Referenced by build(), and ConfRatedAdaboostCostVariable().
{ if (varray[1] && varray[0] && varray[1]->size() != varray[0]->size()) PLERROR("In ConfRatedAdaboostCostVariable: target and output should have same size"); if (varray[2] && varray[2]->size() != 1) PLERROR("In ConfRatedAdaboostCostVariable: target must be a single real"); }
string PLearn::ConfRatedAdaboostCostVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 55 of file ConfRatedAdaboostCostVariable.cc.
void PLearn::ConfRatedAdaboostCostVariable::declareOptions | ( | OptionList & | ol | ) | [static] |
Default constructor for persistence.
Reimplemented from PLearn::NaryVariable.
Definition at line 85 of file ConfRatedAdaboostCostVariable.cc.
{ }
static const PPath& PLearn::ConfRatedAdaboostCostVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::NaryVariable.
Definition at line 60 of file ConfRatedAdaboostCostVariable.h.
: void build_();
ConfRatedAdaboostCostVariable * PLearn::ConfRatedAdaboostCostVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::NaryVariable.
Definition at line 55 of file ConfRatedAdaboostCostVariable.cc.
void PLearn::ConfRatedAdaboostCostVariable::fprop | ( | ) | [virtual] |
compute output given input
Implements PLearn::Variable.
Definition at line 98 of file ConfRatedAdaboostCostVariable.cc.
References PLearn::exp(), i, PLearn::Variable::length(), PLearn::Variable::valuedata, and PLearn::NaryVariable::varray.
{ int signed_target; for(int i=0; i<length(); i++) { signed_target = 2*int(varray[1]->valuedata[i])-1; valuedata[i] = exp(-1*varray[2]->valuedata[0]*signed_target*(2*varray[0]->valuedata[i]-1)); } }
OptionList & PLearn::ConfRatedAdaboostCostVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 55 of file ConfRatedAdaboostCostVariable.cc.
OptionMap & PLearn::ConfRatedAdaboostCostVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 55 of file ConfRatedAdaboostCostVariable.cc.
RemoteMethodMap & PLearn::ConfRatedAdaboostCostVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::Object.
Definition at line 55 of file ConfRatedAdaboostCostVariable.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 92 of file ConfRatedAdaboostCostVariable.cc.
References PLearn::TVec< T >::size(), and PLearn::NaryVariable::varray.
{ l=varray[0]->size(), w=1; }
void PLearn::ConfRatedAdaboostCostVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 121 of file ConfRatedAdaboostCostVariable.cc.
References PLERROR.
{ PLERROR("ConfRatedAdaboostCostVariable::symbolicBprop() not implemented"); }
Reimplemented from PLearn::NaryVariable.
Definition at line 60 of file ConfRatedAdaboostCostVariable.h.