PLearn 0.1
|
returns the elementwise x*log(x) in a (hopefully!) numerically stable way This can be used to compute the Entropy for instance More...
#include <PLogPVariable.h>
Public Member Functions | |
PLogPVariable () | |
Default constructor for persistence. | |
PLogPVariable (Variable *input) | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual PLogPVariable * | 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_ () |
PLogPVariable. | |
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 Public Attributes | |
static StaticInitializer | _static_initializer_ |
Private Types | |
typedef UnaryVariable | inherited |
returns the elementwise x*log(x) in a (hopefully!) numerically stable way This can be used to compute the Entropy for instance
Definition at line 54 of file PLogPVariable.h.
typedef UnaryVariable PLearn::PLogPVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 56 of file PLogPVariable.h.
PLearn::PLogPVariable::PLogPVariable | ( | ) | [inline] |
PLearn::PLogPVariable::PLogPVariable | ( | Variable * | input | ) |
string PLearn::PLogPVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.cc.
OptionList & PLearn::PLogPVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.cc.
RemoteMethodMap & PLearn::PLogPVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.cc.
Object * PLearn::PLogPVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.cc.
StaticInitializer PLogPVariable::_static_initializer_ & PLearn::PLogPVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.cc.
void PLearn::PLogPVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 83 of file PLogPVariable.cc.
References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, PLearn::Variable::nelems(), and PLearn::safeflog().
{ for(int i=0; i<nelems(); i++) { real p = input->valuedata[i]; if(p<1e-10) p = 1e-10; input->gradientdata[i] += gradientdata[i]*(1.0+safeflog(p)); } }
string PLearn::PLogPVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.cc.
static const PPath& PLearn::PLogPVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 63 of file PLogPVariable.h.
{ return new PLogPVariable(v); }
PLogPVariable * PLearn::PLogPVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.cc.
void PLearn::PLogPVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 71 of file PLogPVariable.cc.
References i, PLearn::UnaryVariable::input, PLearn::Variable::nelems(), PLearn::safeflog(), and PLearn::Variable::valuedata.
{ for(int i=0; i<nelems(); i++) { real p = input->valuedata[i]; if(p<1e-10) p = 1e-10; valuedata[i] = p*safeflog(p); } }
OptionList & PLearn::PLogPVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.cc.
OptionMap & PLearn::PLogPVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.cc.
RemoteMethodMap & PLearn::PLogPVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 55 of file PLogPVariable.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 PLogPVariable.cc.
References PLearn::UnaryVariable::input, PLearn::Var::length(), and PLearn::Var::width().
void PLearn::PLogPVariable::symbolicBprop | ( | ) | [virtual] |
compute a piece of new Var graph that represents the symbolic derivative of this Var
Reimplemented from PLearn::Variable.
Definition at line 95 of file PLogPVariable.cc.
References PLearn::Variable::g, PLearn::UnaryVariable::input, and PLearn::log().
Reimplemented from PLearn::UnaryVariable.
Definition at line 63 of file PLogPVariable.h.