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

#include <HyperCommand.h>

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

List of all members.

Public Member Functions

virtual HyperCommanddeepCopy (CopiesMap &copies) const
 HyperCommand ()
virtual void build ()
 Post-constructor.
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.
void setHyperLearner (HyperLearner *the_hlearner)
virtual void setExperimentDirectory (const PPath &the_expdir)
PPath getExperimentDirectory () const
virtual void forget ()
 Resets the command's internal state as if freshly constructed (default does nothing)
virtual Vec optimize ()=0
 Executes the command, returning the resulting costvec of its optimization (or an empty vec if it didn't do any testng).
virtual TVec< string > getResultNames () const =0
 Returns the names of the results returned by the optimize() method.

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 ()

Public Attributes

int verbosity
 Level of verbosity.

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares this class' options.
static void declareMethods (RemoteMethodMap &rmm)
 Declare the methods that are remote-callable.

Protected Attributes

HyperLearnerhlearner
 A 'real' pointer to avoid cycles (and memory leaks)
PPath expdir
 where to report results

Private Types

typedef Object inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 55 of file HyperCommand.h.


Member Typedef Documentation

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 60 of file HyperCommand.h.


Constructor & Destructor Documentation

PLearn::HyperCommand::HyperCommand ( )

Definition at line 50 of file HyperCommand.cc.

    : verbosity(0)
{
}

Member Function Documentation

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 58 of file HyperCommand.cc.

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 58 of file HyperCommand.cc.

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 58 of file HyperCommand.cc.

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 58 of file HyperCommand.cc.

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 58 of file HyperCommand.cc.

void PLearn::HyperCommand::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::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 116 of file HyperCommand.cc.

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

Referenced by PLearn::HyperSetOption::build(), PLearn::HyperRetrain::build(), and PLearn::HyperOptimize::build().

Here is the call graph for this function:

Here is the caller graph for this function:

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

This does the actual building.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 104 of file HyperCommand.cc.

Referenced by build().

{
    // ### 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.
}

Here is the caller graph for this function:

void PLearn::HyperCommand::declareMethods ( RemoteMethodMap rmm) [static, protected]

Declare the methods that are remote-callable.

Reimplemented from PLearn::Object.

Definition at line 82 of file HyperCommand.cc.

References PLearn::Object::_getRemoteMethodMap_(), PLearn::declareMethod(), forget(), getResultNames(), PLearn::RemoteMethodMap::inherited(), and optimize().

{
    // Insert a backpointer to remote methods; note that this is different from
    // declareOptions().
    rmm.inherited(inherited::_getRemoteMethodMap_());

    declareMethod(
        rmm, "forget", &HyperCommand::forget,
        (BodyDoc("Resets the command's internal state as if freshly constructed")));

    declareMethod(
        rmm, "optimize", &HyperCommand::optimize,
        (BodyDoc("Executes the command, returning the resulting costvec of its optimization\n"
                 "(or an empty vec if it didn't do any testng)."),
         RetDoc ("Cost vectors arising from optimization")));

    declareMethod(
        rmm, "getResultNames", &HyperCommand::getResultNames,
        (BodyDoc("Returns the names of the results returned by the optimize() method"),
         RetDoc ("Vector of strings containing the result names")));
}

Here is the call graph for this function:

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

Declares this class' options.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 72 of file HyperCommand.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::Object::declareOptions(), and verbosity.

Referenced by PLearn::HyperSetOption::declareOptions(), PLearn::HyperRetrain::declareOptions(), and PLearn::HyperOptimize::declareOptions().

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

    declareOption(
        ol, "verbosity", &HyperCommand::verbosity, OptionBase::buildoption,
        " The verbosity level. Default to 0.");
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 69 of file HyperCommand.h.

:

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 58 of file HyperCommand.cc.

void PLearn::HyperCommand::forget ( ) [virtual]

Resets the command's internal state as if freshly constructed (default does nothing)

Reimplemented in PLearn::HyperOptimize.

Definition at line 122 of file HyperCommand.cc.

Referenced by declareMethods().

{}

Here is the caller graph for this function:

PPath PLearn::HyperCommand::getExperimentDirectory ( ) const [inline]

Definition at line 115 of file HyperCommand.h.

    { return expdir; }
virtual TVec<string> PLearn::HyperCommand::getResultNames ( ) const [pure virtual]

Returns the names of the results returned by the optimize() method.

Implemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Referenced by declareMethods().

Here is the caller graph for this function:

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 126 of file HyperCommand.cc.

References PLearn::deepCopyField(), hlearner, and PLearn::Object::makeDeepCopyFromShallowCopy().

Referenced by PLearn::HyperSetOption::makeDeepCopyFromShallowCopy(), PLearn::HyperRetrain::makeDeepCopyFromShallowCopy(), and PLearn::HyperOptimize::makeDeepCopyFromShallowCopy().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Vec PLearn::HyperCommand::optimize ( ) [pure virtual]

Executes the command, returning the resulting costvec of its optimization (or an empty vec if it didn't do any testng).

Implemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Referenced by declareMethods().

Here is the caller graph for this function:

void PLearn::HyperCommand::setExperimentDirectory ( const PPath the_expdir) [virtual]

Reimplemented in PLearn::HyperOptimize.

Definition at line 60 of file HyperCommand.cc.

References PLearn::PPath::absolute(), expdir, PLearn::force_mkdir(), and PLERROR.

Referenced by PLearn::HyperOptimize::setExperimentDirectory().

{
    if(the_expdir=="")
        expdir = "";
    else
    {
        if(!force_mkdir(the_expdir))
            PLERROR("In PLearner::setExperimentDirectory Could not create experiment directory %s",the_expdir.c_str());
        expdir = the_expdir.absolute();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::HyperCommand::setHyperLearner ( HyperLearner the_hlearner) [inline]

Definition at line 110 of file HyperCommand.h.

    { hlearner = the_hlearner; }

Member Data Documentation

Reimplemented from PLearn::Object.

Reimplemented in PLearn::HyperOptimize, PLearn::HyperRetrain, and PLearn::HyperSetOption.

Definition at line 69 of file HyperCommand.h.

Level of verbosity.

If 0, should not write anything on cerr. If >0 may write some info on the steps performed (the amount of detail written depends on the value of this option).

Definition at line 69 of file HyperCommand.h.

Referenced by declareOptions(), and PLearn::HyperOptimize::optimize().


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