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

#include <Train.h>

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

List of all members.

Public Member Functions

void run ()
 Override this for runnable objects (default method issues a runtime error).
 Train ()
 Default constructor.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual TraindeepCopy (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 ()

Public Attributes

PP< PLearnerlearner
string psave
VMat trainset

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

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

Private Types

typedef Object inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 53 of file Train.h.


Member Typedef Documentation

typedef Object PLearn::Train::inherited [private]

Reimplemented from PLearn::Object.

Definition at line 58 of file Train.h.


Constructor & Destructor Documentation

PLearn::Train::Train ( )

Default constructor.

Definition at line 51 of file Train.cc.

{
    // ...

    // ### You may or may not want to call build_() to finish building the object
    // build_();
}

Member Function Documentation

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

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
OptionList & PLearn::Train::_getOptionList_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
RemoteMethodMap & PLearn::Train::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
bool PLearn::Train::_isa_ ( const Object o) [static]

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
Object * PLearn::Train::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
StaticInitializer Train::_static_initializer_ & PLearn::Train::_static_initialize_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
void PLearn::Train::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.

Definition at line 102 of file Train.cc.

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

This does the actual building.

Reimplemented from PLearn::Object.

Definition at line 90 of file Train.cc.

{
    // ### This method should do the real building of the object,
    // ### according to set 'options', in *any* situation. 
    // ### Typical situations include:
    // ###  - Initial building of an object from a few user-specified options
    // ###  - Building of a "reloaded" object: i.e. from the complete set of all serialised options.
    // ###  - Updating or "re-building" of an object after a few "tuning" options have been modified.
    // ### You should assume that the parent class' build_() has already been called.
}
string PLearn::Train::classname ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
void PLearn::Train::declareOptions ( OptionList ol) [static, protected]

Declares this class' options.

Reimplemented from PLearn::Object.

Definition at line 65 of file Train.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), learner, psave, and trainset.

{
    // ### Declare all of this object's options here
    // ### For the "flags" of each option, you should typically specify  
    // ### one of OptionBase::buildoption, OptionBase::learntoption or 
    // ### OptionBase::tuningoption. Another possible flag to be combined with
    // ### is OptionBase::nosave

    // ### ex:
    // declareOption(ol, "myoption", &Train::myoption, OptionBase::buildoption,
    //               "Help text describing this option");
    // ...
    declareOption(ol, "dataset", &Train::trainset, OptionBase::buildoption,
                  "Any valid vmat");

    declareOption(ol, "psave", &Train::psave, OptionBase::buildoption,
                  "Name of the file .psave");
  
    declareOption(ol, "learner", &Train::learner, OptionBase::buildoption,
                  "Any valid learner");

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

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 110 of file Train.h.

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

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
OptionList & PLearn::Train::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
OptionMap & PLearn::Train::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
RemoteMethodMap & PLearn::Train::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 63 of file Train.cc.

: plearn myTrain.plearn knn=12");
void PLearn::Train::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::Object.

Definition at line 118 of file Train.cc.

References PLERROR.

{
    inherited::makeDeepCopyFromShallowCopy(copies);

    // ### Call deepCopyField on all "pointer-like" fields 
    // ### that you wish to be deepCopied rather than 
    // ### shallow-copied.
    // ### ex:
    // deepCopyField(trainvec, copies);

    // ### Remove this line when you have fully implemented this method.
    PLERROR("Train::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!");
}
void PLearn::Train::run ( ) [virtual]

Override this for runnable objects (default method issues a runtime error).

Runnable objects are objects that can be used as *THE* object of a .plearn script. The run() method specifies what they should do when executed.

Reimplemented from PLearn::Object.

Definition at line 108 of file Train.cc.

References PLearn::endl(), and PLearn::save().

{
    PP<VecStatsCollector> train_stats = new VecStatsCollector();
    learner->setTrainStatsCollector(train_stats);
    learner->setTrainingSet(trainset);
    learner->train();
    cout<<"Saving learner in :"<<psave<<endl;
    PLearn::save(psave, learner);
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::Object.

Definition at line 110 of file Train.h.

Definition at line 73 of file Train.h.

Referenced by declareOptions().

Definition at line 75 of file Train.h.

Referenced by declareOptions().

Definition at line 76 of file Train.h.

Referenced by declareOptions().


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