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

#include <LearnerProcessedVMatrix.h>

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

List of all members.

Public Member Functions

 LearnerProcessedVMatrix ()
virtual void build ()
 Simply calls inherited::build() then build_().
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual LearnerProcessedVMatrixdeepCopy (CopiesMap &copies) const

Static Public Member Functions

static string _classname_ ()
 Declares name and deepCopy methods.
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 ()

Public Attributes

VMat source
 The source vmatrix whose inputs wil be porcessed by the learner If present, the target and weight columns will be appended to the processed input in the resulting matrix.
PP< PLearnerlearner
 The learner used to process the VMat's input.
char train_learner
 Indicates if the learner should be trained on the source, and on what part '0': don't train 'S': supervised training using input and target (possibly weighted if weight is present) 'U': unsupervised training using only input part (possibly weighted if weight is present).

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Member Functions

virtual void getNewRow (int i, const Vec &v) const
 This is the only method requiring implementation.

Static Protected Member Functions

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

Private Types

typedef RowBufferedVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 50 of file LearnerProcessedVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 52 of file LearnerProcessedVMatrix.h.


Constructor & Destructor Documentation

PLearn::LearnerProcessedVMatrix::LearnerProcessedVMatrix ( )

Definition at line 51 of file LearnerProcessedVMatrix.cc.

References build_().

    :train_learner('-')
{
    build_();
}

Here is the call graph for this function:


Member Function Documentation

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

Declares name and deepCopy methods.

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

void PLearn::LearnerProcessedVMatrix::build ( ) [virtual]

Simply calls inherited::build() then build_().

Reimplemented from PLearn::VMatrix.

Definition at line 115 of file LearnerProcessedVMatrix.cc.

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

Here is the call graph for this function:

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

This does the actual building.

Reimplemented from PLearn::VMatrix.

Definition at line 90 of file LearnerProcessedVMatrix.cc.

References learner, PLearn::VMat::length(), PLearn::VMatrix::length_, source, PLearn::VMat::subMatColumns(), train_learner, and PLearn::VMatrix::width_.

Referenced by build(), and LearnerProcessedVMatrix().

{
    if (source && learner) {
        switch(train_learner) {
        case '-':
            break;
        case 'S':
            learner->setTrainingSet(source);
            learner->setTrainStatsCollector(new VecStatsCollector());
            learner->train();
            break;
        case 'U':
        {
            VMat inputs = source.subMatColumns(0,source->inputsize());
            learner->setTrainingSet(inputs);
            learner->setTrainStatsCollector(new VecStatsCollector());
            learner->train();
        }
        }
        length_ = source->length();
        width_ = learner->outputsize() + source->targetsize() + source->weightsize();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

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

Declares this class' options.

Reimplemented from PLearn::VMatrix.

Definition at line 71 of file LearnerProcessedVMatrix.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::VMatrix::declareOptions(), learner, source, and train_learner.

{
    declareOption(ol, "source", &LearnerProcessedVMatrix::source, OptionBase::buildoption,
                  "The source vmatrix whose inputs wil be porcessed by the learner.\n"
                  "If present, the target and weight columns will be appended to the processed input in the resulting matrix.");
  
    declareOption(ol, "learner", &LearnerProcessedVMatrix::learner, OptionBase::buildoption,
                  "The learner used to process the VMat's input.");

    declareOption(ol, "train_learner", &LearnerProcessedVMatrix::train_learner, OptionBase::buildoption, 
                  "Indicates if the learner should be trained on the source, upon building, and if so on what part.\n"
                  " '-': don't train \n"
                  " 'S': supervised training using input and target (possibly weighted if weight is  present) \n"
                  " 'U': unsupervised training using only input part (possibly weighted if weight is present). \n");

    // Now call the parent class' declareOptions
    inherited::declareOptions(ol);
}

Here is the call graph for this function:

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 111 of file LearnerProcessedVMatrix.h.

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

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

void PLearn::LearnerProcessedVMatrix::getNewRow ( int  i,
const Vec v 
) const [protected, virtual]

This is the only method requiring implementation.

Implements PLearn::RowBufferedVMatrix.

Definition at line 57 of file LearnerProcessedVMatrix.cc.

References learner, PLearn::TVec< T >::resize(), source, PLearn::TVec< T >::subVec(), and PLearn::VMat::width().

{
    static Vec sv;
    sv.resize(source.width());
    source->getRow(i,sv);
    int nin = source->inputsize();
    int nout = learner->outputsize();
    Vec input = sv.subVec(0,nin);
    Vec output = v.subVec(0,nout);
    learner->computeOutput(input,output);
    int rest = source.width()-nin;
    v.subVec(nout,rest) << sv.subVec(nin,rest);
}

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

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

Reimplemented from PLearn::Object.

Definition at line 48 of file LearnerProcessedVMatrix.cc.

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 121 of file LearnerProcessedVMatrix.cc.

References PLearn::deepCopyField(), learner, PLearn::RowBufferedVMatrix::makeDeepCopyFromShallowCopy(), and source.

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::RowBufferedVMatrix.

Definition at line 111 of file LearnerProcessedVMatrix.h.

The learner used to process the VMat's input.

Definition at line 70 of file LearnerProcessedVMatrix.h.

Referenced by build_(), declareOptions(), getNewRow(), and makeDeepCopyFromShallowCopy().

The source vmatrix whose inputs wil be porcessed by the learner If present, the target and weight columns will be appended to the processed input in the resulting matrix.

Definition at line 67 of file LearnerProcessedVMatrix.h.

Referenced by build_(), declareOptions(), getNewRow(), and makeDeepCopyFromShallowCopy().

Indicates if the learner should be trained on the source, and on what part '0': don't train 'S': supervised training using input and target (possibly weighted if weight is present) 'U': unsupervised training using only input part (possibly weighted if weight is present).

Definition at line 76 of file LearnerProcessedVMatrix.h.

Referenced by build_(), and declareOptions().


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