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

#include <LiftOutputVariable.h>

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

List of all members.

Public Member Functions

 LiftOutputVariable ()
 Default constructor for persistence.
 LiftOutputVariable (Variable *netout, Variable *target)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual LiftOutputVariabledeepCopy (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 ()

Static Public Member Functions

static string _classname_ ()
 LiftOutputVariable.
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_

Protected Member Functions

void build_ ()
 This does the actual building.

Private Types

typedef BinaryVariable inherited

Detailed Description

Definition at line 48 of file LiftOutputVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::BinaryVariable.

Definition at line 50 of file LiftOutputVariable.h.


Constructor & Destructor Documentation

PLearn::LiftOutputVariable::LiftOutputVariable ( ) [inline]

Default constructor for persistence.

Definition at line 54 of file LiftOutputVariable.h.

{}
PLearn::LiftOutputVariable::LiftOutputVariable ( Variable netout,
Variable target 
)

Definition at line 58 of file LiftOutputVariable.cc.

References build_().

    : inherited(netout,target,netout->length(),netout->width())
{
    build_();
}

Here is the call graph for this function:


Member Function Documentation

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

LiftOutputVariable.

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file LiftOutputVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file LiftOutputVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file LiftOutputVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file LiftOutputVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 53 of file LiftOutputVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file LiftOutputVariable.cc.

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

Implements PLearn::Variable.

Definition at line 121 of file LiftOutputVariable.cc.

References PLearn::Variable::gradientdata, i, and PLearn::BinaryVariable::input1.

{
    // TODO Not really sure what to do here, bprop shouldn't be used anyway.
    // Actually it IS called, should investigate why and what it does.
    // PLWARNING("In LiftOutputVariable::bprop - You should not backprop on a LiftOutputVariable");
    real gr = *gradientdata;
    for (int i=0; i<input1->size(); i++)
    {
        input1->gradientdata[i] += gr;
    }
}
void PLearn::LiftOutputVariable::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::BinaryVariable.

Definition at line 65 of file LiftOutputVariable.cc.

References PLearn::BinaryVariable::build(), and build_().

Here is the call graph for this function:

void PLearn::LiftOutputVariable::build_ ( ) [protected]

This does the actual building.

Reimplemented from PLearn::BinaryVariable.

Definition at line 72 of file LiftOutputVariable.cc.

References PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, and PLERROR.

Referenced by build(), and LiftOutputVariable().

{
    if (input1 && input2) {
        // input1 and input2 are (respectively) netout and target from the constructor
        if(input1->size() != input2->size())
            PLERROR("In LiftOutputVariable: netout and target must have the same size");
    }
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 53 of file LiftOutputVariable.cc.

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

Reimplemented from PLearn::BinaryVariable.

Definition at line 57 of file LiftOutputVariable.h.

:
    void build_();
LiftOutputVariable * PLearn::LiftOutputVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::BinaryVariable.

Definition at line 53 of file LiftOutputVariable.cc.

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

compute output given input

Implements PLearn::Variable.

Definition at line 97 of file LiftOutputVariable.cc.

References PLearn::fast_exact_is_equal(), i, PLearn::BinaryVariable::input1, PLearn::BinaryVariable::input2, PLearn::is_missing(), MISSING_VALUE, PLASSERT, PLearn::Variable::size(), and PLearn::Variable::valuedata.

{
    for(int i=0;i<size(); i++)
    {
        real output = input1->valuedata[i];
        real target = input2->valuedata[i];
        if(!is_missing(target))
        {
            PLASSERT(fast_exact_is_equal(target, 0) || fast_exact_is_equal(target, 1.0));
            if (fast_exact_is_equal(target, 1.0)) {
                if (fast_exact_is_equal(output, 0.0)) {
                    // We need to make sure the output is positive.
                    output = 1e-10;
                }
                valuedata[i] = output;
            } else {
                valuedata[i] = -output;
            }
        }
        else
            valuedata[i] = MISSING_VALUE;
    }
}

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 53 of file LiftOutputVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 53 of file LiftOutputVariable.cc.

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

Reimplemented from PLearn::Object.

Definition at line 53 of file LiftOutputVariable.cc.

void PLearn::LiftOutputVariable::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 84 of file LiftOutputVariable.cc.

References PLearn::BinaryVariable::input1, PLearn::Var::length(), and PLearn::Var::width().

{ 
    //l=1, w=1;
    if(input1)
    {
        l=input1->length(); 
        w=input1->width(); 
    }
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::BinaryVariable.

Definition at line 57 of file LiftOutputVariable.h.


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