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

#include <GenerateDecisionPlot.h>

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

List of all members.

Public Types

typedef Object inherited

Public Member Functions

 GenerateDecisionPlot ()
virtual void run ()
 Overload this for runnable objects (default method issues a runtime error)
virtual void build ()
 Post-constructor.
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 GenerateDecisionPlotdeepCopy (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

string basename
PP< PLearnerlearner
int nx
int ny
bool include_datapoint_grid
real xmin
real xmax
real ymin
real ymax
string save_learner_as

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

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

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 50 of file GenerateDecisionPlot.h.


Member Typedef Documentation

Reimplemented from PLearn::Object.

Definition at line 62 of file GenerateDecisionPlot.h.


Constructor & Destructor Documentation

PLearn::GenerateDecisionPlot::GenerateDecisionPlot ( )

Member Function Documentation

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

Declares name and deepCopy methods.

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

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

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

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

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

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

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

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

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

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

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

void PLearn::GenerateDecisionPlot::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 548 of file GenerateDecisionPlot.cc.

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

Here is the call graph for this function:

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

This does the actual building.

Reimplemented from PLearn::Object.

Definition at line 510 of file GenerateDecisionPlot.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:

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

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

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

Declares this class' options.

Reimplemented from PLearn::Object.

Definition at line 473 of file GenerateDecisionPlot.cc.

References basename, PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::Object::declareOptions(), include_datapoint_grid, learner, nx, ny, save_learner_as, xmax, xmin, ymax, and ymin.

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

    declareOption(ol, "basename", &GenerateDecisionPlot::basename, OptionBase::buildoption,
                  "Base name of the .dx data file to generate. Running this class will generate\n"
                  "files basename_dset.dx containing targets and outputs for the given dataset positions\n"
                  "and basename_outputs.dx containing outputs computed at grid positions\n");
    declareOption(ol, "learner", &GenerateDecisionPlot::learner, OptionBase::buildoption,
                  "The learner to train/test. Its train_set will be used as the dataset on\n"
                  "which to base this decision plot (ranges are inferred from it, and decisions\n"
                  "on the training points are written in basename_dset.dx");
    declareOption(ol, "nx", &GenerateDecisionPlot::nx, OptionBase::buildoption,
                  "Number of x sample coordinates (grid)");
    declareOption(ol, "ny", &GenerateDecisionPlot::ny, OptionBase::buildoption,
                  "Number of y sample coordinates (grid)");
    declareOption(ol, "include_datapoint_grid", &GenerateDecisionPlot::include_datapoint_grid, OptionBase::buildoption,
                  "");
    declareOption(ol, "xmin", &GenerateDecisionPlot::xmin, OptionBase::buildoption,
                  "");
    declareOption(ol, "xmax", &GenerateDecisionPlot::xmax, OptionBase::buildoption,
                  "");
    declareOption(ol, "ymin", &GenerateDecisionPlot::ymin, OptionBase::buildoption,
                  "");
    declareOption(ol, "ymax", &GenerateDecisionPlot::ymax, OptionBase::buildoption,
                  "");
    declareOption(ol, "save_learner_as", &GenerateDecisionPlot::save_learner_as, OptionBase::buildoption,
                  "(Optionally) save trained learner in this file (.psave)");

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

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 110 of file GenerateDecisionPlot.h.

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

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

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

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

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

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

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

Reimplemented from PLearn::Object.

Definition at line 471 of file GenerateDecisionPlot.cc.

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::Object.

Definition at line 555 of file GenerateDecisionPlot.cc.

References PLearn::Object::makeDeepCopyFromShallowCopy().

Here is the call graph for this function:

void PLearn::GenerateDecisionPlot::run ( ) [virtual]

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

Reimplemented from PLearn::Object.

Definition at line 522 of file GenerateDecisionPlot.cc.

References PLearn::DX_create_dataset_outputs_file(), PLearn::DX_create_grid_outputs_file(), PLearn::endl(), include_datapoint_grid, learner, nx, ny, PLearn::Object::save(), save_learner_as, xmax, xmin, ymax, and ymin.

{
    VMat dataset = learner->getTrainingSet();
    learner->setTrainStatsCollector(new VecStatsCollector());
    learner->train();

    if(save_learner_as!="")
    {
        cerr << "Saving trained learner in file " << save_learner_as << endl;
        PLearn::save(save_learner_as, *learner);
    }

    string dset_fname = basename+"_dset.dx";
    cerr << "Computing and writing dataset output field to file " << dset_fname << endl;
    DX_create_dataset_outputs_file(dset_fname, learner, dataset);

    string outputs_fname = basename+"_outputs.dx";
    cerr << "Computing and writing grid output field to file " << outputs_fname << endl; 
    DX_create_grid_outputs_file(outputs_fname, learner, dataset, nx, ny, 
                                include_datapoint_grid, 
                                xmin, xmax, ymin, ymax);
    cerr << "You can now view those files with OpenDX." << endl;
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::Object.

Definition at line 110 of file GenerateDecisionPlot.h.

Definition at line 68 of file GenerateDecisionPlot.h.

Referenced by declareOptions().

Definition at line 72 of file GenerateDecisionPlot.h.

Referenced by declareOptions(), and run().

Definition at line 69 of file GenerateDecisionPlot.h.

Referenced by declareOptions(), and run().

Definition at line 70 of file GenerateDecisionPlot.h.

Referenced by declareOptions(), and run().

Definition at line 71 of file GenerateDecisionPlot.h.

Referenced by declareOptions(), and run().

Definition at line 74 of file GenerateDecisionPlot.h.

Referenced by declareOptions(), and run().

Definition at line 73 of file GenerateDecisionPlot.h.

Referenced by declareOptions(), and run().

Definition at line 73 of file GenerateDecisionPlot.h.

Referenced by declareOptions(), and run().

Definition at line 73 of file GenerateDecisionPlot.h.

Referenced by declareOptions(), and run().

Definition at line 73 of file GenerateDecisionPlot.h.

Referenced by declareOptions(), and run().


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