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 | Private Attributes
PLearn::ReIndexedTargetVMatrix Class Reference

VMatrix the reindexes the target fields of a source VMatrix, according to the getValues(row,target_col) function, where row contains the values of a row of the source VMatrix, and target_col is the column index of (one of ) the target field. More...

#include <ReIndexedTargetVMatrix.h>

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

List of all members.

Public Member Functions

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

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

bool ignore_oov_tag
 Indication that the OOV_TAG must be ignored in the possible values.

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Member Functions

virtual void getNewRow (int i, const Vec &v) const
 Fill the vector 'v' with the content of the i-th row.

Static Protected Member Functions

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

Private Types

typedef SourceVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.

Private Attributes

Vec values
 Vector of possible values.
int t
 getNewRow temporary values
int index
int oov_index

Detailed Description

VMatrix the reindexes the target fields of a source VMatrix, according to the getValues(row,target_col) function, where row contains the values of a row of the source VMatrix, and target_col is the column index of (one of ) the target field.

This is useful when the possible target values change from one row to another. This way, target values will range from 0 to getValues(row,target_col).length()-1. The source VMatrix must be able to fournish the Dictionary objects for the target fields.

Definition at line 61 of file ReIndexedTargetVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::SourceVMatrix.

Definition at line 63 of file ReIndexedTargetVMatrix.h.


Constructor & Destructor Documentation

PLearn::ReIndexedTargetVMatrix::ReIndexedTargetVMatrix ( )

Default constructor.

Definition at line 59 of file ReIndexedTargetVMatrix.cc.

    : ignore_oov_tag(false)
{}

Member Function Documentation

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

Declares name and deepCopy methods.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 77 of file ReIndexedTargetVMatrix.cc.

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

Here is the call graph for this function:

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

This does the actual building.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 86 of file ReIndexedTargetVMatrix.cc.

References PLearn::SourceVMatrix::setMetaInfoFromSource().

Referenced by build().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

Declares the class options.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 66 of file ReIndexedTargetVMatrix.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::SourceVMatrix::declareOptions(), and ignore_oov_tag.

{
    declareOption(ol, "ignore_oov_tag", &ReIndexedTargetVMatrix::ignore_oov_tag, OptionBase::buildoption,
                  "Indication that the OOV_TAG must be ignored in the possible values.\n");

    inherited::declareOptions(ol);
}

Here is the call graph for this function:

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 76 of file ReIndexedTargetVMatrix.h.

:

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

Fill the vector 'v' with the content of the i-th row.

v is assumed to be the right size.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 94 of file ReIndexedTargetVMatrix.cc.

References PLearn::TVec< T >::find(), ignore_oov_tag, index, PLearn::VMatrix::inputsize_, PLearn::TVec< T >::length(), oov_index, OOV_TAG, PLERROR, PLearn::SourceVMatrix::source, t, PLearn::VMatrix::targetsize_, and values.

{
    source->getRow(i,v);
    for(t=inputsize_; t<targetsize_+inputsize_; t++)
    {
        source->getValues(i,t,values);

        oov_index = -1;
        if(ignore_oov_tag)
        {
            oov_index = source->getDictionary()->getId(OOV_TAG);
            oov_index = values.find(oov_index);
        }
        if(oov_index < 0) oov_index = values.length();

        index = values.find(v[t]);
        if(index < 0) PLERROR("In ReIndexedTargetVMatrix::getNewRow(): target (%d) isn't a possible value", v[t]);
        if(index == oov_index) PLERROR("In ReIndexedTargetVMatrix::getNewRow(): target (%d) is OOV_TAG, but OOV_TAG ignored", v[t]);
        v[t] = index<oov_index?index:index-1;
    }
}

Here is the call graph for this function:

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

Reimplemented from PLearn::SourceVMatrix.

Definition at line 54 of file ReIndexedTargetVMatrix.cc.

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 119 of file ReIndexedTargetVMatrix.cc.

References PLearn::SourceVMatrix::makeDeepCopyFromShallowCopy().

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::SourceVMatrix.

Definition at line 76 of file ReIndexedTargetVMatrix.h.

Indication that the OOV_TAG must be ignored in the possible values.

Definition at line 68 of file ReIndexedTargetVMatrix.h.

Referenced by declareOptions(), and getNewRow().

Definition at line 105 of file ReIndexedTargetVMatrix.h.

Referenced by getNewRow().

Definition at line 105 of file ReIndexedTargetVMatrix.h.

Referenced by getNewRow().

getNewRow temporary values

Definition at line 105 of file ReIndexedTargetVMatrix.h.

Referenced by getNewRow().

Vector of possible values.

Definition at line 102 of file ReIndexedTargetVMatrix.h.

Referenced by getNewRow().


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