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

#include <LogaddOnBagsModule.h>

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

List of all members.

Public Member Functions

 LogaddOnBagsModule ()
 Default constructor.
virtual void fpropAcc (const Vec &input)
 update internal statistics needed to compute the output of bag
virtual void fpropInit (const Vec &input)
virtual void fpropOutput (Vec &output)
virtual void bprop (const Mat &baginputs, const Vec &bagoutput_gradient, Mat &baginputs_gradients)
 compute the gradient w.r.t bag inputs
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual LogaddOnBagsModuledeepCopy (CopiesMap &copies) const
virtual void build ()
 Post-constructor.
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.

Static Public Member Functions

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

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares the class options.

Protected Attributes

Vec accumulated_output

Private Types

typedef OnBagsModule inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 48 of file LogaddOnBagsModule.h.


Member Typedef Documentation

Reimplemented from PLearn::OnBagsModule.

Definition at line 50 of file LogaddOnBagsModule.h.


Constructor & Destructor Documentation

PLearn::LogaddOnBagsModule::LogaddOnBagsModule ( )

Default constructor.

Definition at line 54 of file LogaddOnBagsModule.cc.

{
    output_size = -1;
}

Member Function Documentation

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

void PLearn::LogaddOnBagsModule::bprop ( const Mat baginputs,
const Vec bagoutput_gradient,
Mat baginputs_gradients 
) [virtual]

compute the gradient w.r.t bag inputs

Reimplemented from PLearn::OnBagsModule.

Definition at line 112 of file LogaddOnBagsModule.cc.

References PLearn::TMat< T >::column(), i, PLearn::TMat< T >::length(), PLearn::TVec< T >::resize(), PLearn::TMat< T >::resize(), PLearn::softmax(), and PLearn::TMat< T >::toVecCopy().

{
    int nsamples = baginputs.length();
    baginputs_gradients.resize( nsamples, input_size);
    for( int i = 0; i < input_size; i++ )
    {
        Vec tmp_input_gradient;
        tmp_input_gradient.resize( nsamples );
        softmax( baginputs.column(i).toVecCopy() ,
                 tmp_input_gradient );
        tmp_input_gradient *= bagoutput_gradient[i];
        baginputs_gradients.column(i) << tmp_input_gradient;
    }
}

Here is the call graph for this function:

void PLearn::LogaddOnBagsModule::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::OnBagsModule.

Definition at line 76 of file LogaddOnBagsModule.cc.

void PLearn::LogaddOnBagsModule::build_ ( ) [private]

This does the actual building.

Reimplemented from PLearn::OnBagsModule.

Definition at line 68 of file LogaddOnBagsModule.cc.

References PLASSERT.

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

void PLearn::LogaddOnBagsModule::declareOptions ( OptionList ol) [static, protected]

Declares the class options.

Reimplemented from PLearn::OnBagsModule.

Definition at line 59 of file LogaddOnBagsModule.cc.

References PLearn::OptionBase::learntoption, PLearn::OnlineLearningModule::output_size, and PLearn::redeclareOption().

{
    inherited::declareOptions(ol);

    redeclareOption(ol, "output_size", &LogaddOnBagsModule::output_size,
                  OptionBase::learntoption,
                  "Size of the 'output' port (same as 'input').");
}

Here is the call graph for this function:

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 79 of file LogaddOnBagsModule.h.

:

LogaddOnBagsModule * PLearn::LogaddOnBagsModule::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

void PLearn::LogaddOnBagsModule::fpropAcc ( const Vec input) [virtual]

update internal statistics needed to compute the output of bag

Reimplemented from PLearn::OnBagsModule.

Definition at line 96 of file LogaddOnBagsModule.cc.

References i, and PLearn::logadd().

{
    for( int i = 0; i < input_size; i++ )
        accumulated_output[i] = logadd(accumulated_output[i],
                                       input[i]);
}

Here is the call graph for this function:

void PLearn::LogaddOnBagsModule::fpropInit ( const Vec input) [virtual]

Reimplemented from PLearn::OnBagsModule.

Definition at line 92 of file LogaddOnBagsModule.cc.

{
    accumulated_output << input;
}
void PLearn::LogaddOnBagsModule::fpropOutput ( Vec output) [virtual]

Reimplemented from PLearn::OnBagsModule.

Definition at line 102 of file LogaddOnBagsModule.cc.

References PLearn::TVec< T >::resize().

{
    output.resize( output_size );
    output << accumulated_output;
}

Here is the call graph for this function:

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

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

Reimplemented from PLearn::OnBagsModule.

Definition at line 52 of file LogaddOnBagsModule.cc.

void PLearn::LogaddOnBagsModule::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::OnBagsModule.

Definition at line 82 of file LogaddOnBagsModule.cc.

References PLearn::deepCopyField().

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::OnBagsModule.

Definition at line 79 of file LogaddOnBagsModule.h.

Definition at line 89 of file LogaddOnBagsModule.h.


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