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

Base class for sets of sparse features. More...

#include <FeatureSet.h>

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

List of all members.

Public Member Functions

 FeatureSet ()
 Default constructor.
virtual FeatureSetdeepCopy (CopiesMap &copies) const
virtual void build ()
 Post-constructor.
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.
virtual void getFeatures (string token, TVec< int > &feats)=0
 Gives features of token in index form.
virtual string getStringFeature (int index)=0
 Gives string form of a feature in index form An invalid feature index should provoke an error.
virtual int getIndexFeature (string str)=0
 Gives index form of a feature in string form An invalid string feature should provoke an error.
virtual int size ()=0
 Gives the number of features in the set.
virtual void addFeatures (string token)=0
 Adds the features for a given token in the set.
virtual void addFeatures (VMat tokens, int min_freq=-1)=0
 Adds the features for the tokens contained in the set.
virtual void clear ()=0
 Clears all features from the feature set.
virtual void getNewFeaturesString (string token, TVec< string > &feats_str)=0
 Gives the possibly new features in string form for a token.

Static Public Member Functions

static string _classname_ ()
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
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.

Private Types

typedef Object inherited

Private Member Functions

void build_ ()
 This does the actual building.

Private Attributes

TVec< string > feats_str
 Temporary computations vector.

Detailed Description

Base class for sets of sparse features.

FeatureSet provides an abstraction for feature sets, where features are indexed from 0 to size()-1 and have a string representation. They can be added token by token, or by specifying a VMat of tokens. Features can be filtered based on their frequencies in that VMat.

Definition at line 56 of file FeatureSet.h.


Member Typedef Documentation


Constructor & Destructor Documentation

PLearn::FeatureSet::FeatureSet ( )

Default constructor.

Definition at line 54 of file FeatureSet.cc.

{}

Member Function Documentation

string PLearn::FeatureSet::_classname_ ( ) [static]
OptionList & PLearn::FeatureSet::_getOptionList_ ( ) [static]
RemoteMethodMap & PLearn::FeatureSet::_getRemoteMethodMap_ ( ) [static]
bool PLearn::FeatureSet::_isa_ ( const Object o) [static]
StaticInitializer FeatureSet::_static_initializer_ & PLearn::FeatureSet::_static_initialize_ ( ) [static]
virtual void PLearn::FeatureSet::addFeatures ( string  token) [pure virtual]

Adds the features for a given token in the set.

Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.

virtual void PLearn::FeatureSet::addFeatures ( VMat  tokens,
int  min_freq = -1 
) [pure virtual]

Adds the features for the tokens contained in the set.

Features with frequency smaller than min_freq are not added.

Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.

void PLearn::FeatureSet::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::Object.

Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.

Definition at line 58 of file FeatureSet.cc.

Referenced by PLearn::HashMapFeatureSet::build(), and PLearn::CachedFeatureSet::build().

Here is the caller graph for this function:

void PLearn::FeatureSet::build_ ( ) [private]
virtual void PLearn::FeatureSet::clear ( ) [pure virtual]

Clears all features from the feature set.

Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.

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

Declares the class options.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.

Definition at line 71 of file FeatureSet.cc.

Referenced by PLearn::HashMapFeatureSet::declareOptions(), and PLearn::CachedFeatureSet::declareOptions().

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

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.

Definition at line 72 of file FeatureSet.h.

:
    //#####  Protected Options  ###############################################
FeatureSet * PLearn::FeatureSet::deepCopy ( CopiesMap copies) const [virtual]
virtual void PLearn::FeatureSet::getFeatures ( string  token,
TVec< int > &  feats 
) [pure virtual]

Gives features of token in index form.

Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.

virtual int PLearn::FeatureSet::getIndexFeature ( string  str) [pure virtual]

Gives index form of a feature in string form An invalid string feature should provoke an error.

Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.

virtual void PLearn::FeatureSet::getNewFeaturesString ( string  token,
TVec< string > &  feats_str 
) [pure virtual]
virtual string PLearn::FeatureSet::getStringFeature ( int  index) [pure virtual]

Gives string form of a feature in index form An invalid feature index should provoke an error.

Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, PLearn::HashMapFeatureSet, PLearn::IdentityFeatureSet, PLearn::PythonFeatureSet, and PLearn::WordNetFeatureSet.

Definition at line 64 of file FeatureSet.cc.

Referenced by PLearn::HashMapFeatureSet::makeDeepCopyFromShallowCopy(), and PLearn::CachedFeatureSet::makeDeepCopyFromShallowCopy().

{
    inherited::makeDeepCopyFromShallowCopy(copies);

    //PLERROR("FeatureSet::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!");
}

Here is the caller graph for this function:

virtual int PLearn::FeatureSet::size ( ) [pure virtual]

Gives the number of features in the set.

Implemented in PLearn::CachedFeatureSet, PLearn::ConcatDisjointFeatureSet, and PLearn::HashMapFeatureSet.


Member Data Documentation

Temporary computations vector.

Definition at line 128 of file FeatureSet.h.


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