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

This is the primitive of a sigmoid: log(1+exp(x)) More...

#include <DilogarithmVariable.h>

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

List of all members.

Public Member Functions

 DilogarithmVariable ()
 Default constructor for persistence.
 DilogarithmVariable (Variable *input)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual DilogarithmVariabledeepCopy (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_ ()
 DilogarithmVariable.
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 Public Attributes

static StaticInitializer _static_initializer_

Private Types

typedef UnaryVariable inherited

Detailed Description

This is the primitive of a sigmoid: log(1+exp(x))

Definition at line 55 of file DilogarithmVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 57 of file DilogarithmVariable.h.


Constructor & Destructor Documentation

PLearn::DilogarithmVariable::DilogarithmVariable ( ) [inline]

Default constructor for persistence.

Definition at line 61 of file DilogarithmVariable.h.

{}
PLearn::DilogarithmVariable::DilogarithmVariable ( Variable input)

Definition at line 58 of file DilogarithmVariable.cc.

    : inherited(input, input->length(), input->width())
{}

Member Function Documentation

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

DilogarithmVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 85 of file DilogarithmVariable.cc.

References PLearn::Variable::gradientdata, i, PLearn::UnaryVariable::input, and PLearn::Variable::nelems().

{
    for(int i=0; i<nelems(); i++)
    {
        real xi = input->valuedata[i];
        if (xi!=0)
            input->gradientdata[i] -= gradientdata[i] * log1p(-xi)/xi;
    }
}

Here is the call graph for this function:

string PLearn::DilogarithmVariable::classname ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 64 of file DilogarithmVariable.h.

{ return new DilogarithmVariable(v); }
DilogarithmVariable * PLearn::DilogarithmVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 72 of file DilogarithmVariable.cc.

References PLearn::dilogarithm(), i, PLearn::UnaryVariable::input, PLearn::is_missing(), PLearn::Variable::nelems(), PLWARNING, and PLearn::Variable::valuedata.

{
    for(int i=0; i<nelems(); i++)
    {
        valuedata[i] = dilogarithm(input->valuedata[i]);
#ifdef BOUNDCHECK
        if (is_missing(valuedata[i]))
            PLWARNING("dilogarithm returned NaN");
#endif
    }
}

Here is the call graph for this function:

OptionList & PLearn::DilogarithmVariable::getOptionList ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file DilogarithmVariable.cc.

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

References PLERROR.

{
    PLERROR("DilogarithmVariable::symbolicBprop() not implemented");
}

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 64 of file DilogarithmVariable.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines