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::ParzenWindow Class Reference

#include <ParzenWindow.h>

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

List of all members.

Public Member Functions

 ParzenWindow ()
 ParzenWindow (real isotropic_sigma)
virtual void build ()
 Simply calls inherited::build() then build_().
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 ParzenWindowdeepCopy (CopiesMap &copies) const
virtual void train ()
 trains the model

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

real isotropic_sigma

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

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

Private Types

typedef GaussMix inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 44 of file ParzenWindow.h.


Member Typedef Documentation

Reimplemented from PLearn::GaussMix.

Definition at line 49 of file ParzenWindow.h.


Constructor & Destructor Documentation

PLearn::ParzenWindow::ParzenWindow ( )

Definition at line 57 of file ParzenWindow.cc.

References PLearn::PLearner::nstages.

    : isotropic_sigma(1)
{
    nstages = 1;
}
PLearn::ParzenWindow::ParzenWindow ( real  isotropic_sigma)

Definition at line 63 of file ParzenWindow.cc.

    : isotropic_sigma(the_isotropic_sigma)
{
}

Member Function Documentation

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

Declares name and deepCopy methods.

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

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

Reimplemented from PLearn::GaussMix.

Definition at line 69 of file ParzenWindow.cc.

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

Referenced by train().

Here is the call graph for this function:

Here is the caller graph for this function:

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

This does the actual building.

Reimplemented from PLearn::GaussMix.

Definition at line 90 of file ParzenWindow.cc.

Referenced by build().

{}

Here is the caller graph for this function:

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

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

Declares this class' options.

Reimplemented from PLearn::GaussMix.

Definition at line 81 of file ParzenWindow.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::GaussMix::declareOptions(), and isotropic_sigma.

{
    declareOption(ol,"isotropic_sigma", &ParzenWindow::isotropic_sigma, OptionBase::buildoption,
                  "Spherical standard deviation parameter (NOTE: old implementation called this sigma_square, but it really was sigma, hence the renaming)");

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

Here is the call graph for this function:

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

Reimplemented from PLearn::GaussMix.

Definition at line 100 of file ParzenWindow.h.

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

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

Reimplemented from PLearn::GaussMix.

Definition at line 50 of file ParzenWindow.cc.

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::GaussMix.

Definition at line 93 of file ParzenWindow.cc.

References PLearn::GaussMix::makeDeepCopyFromShallowCopy().

{
    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("ParzenWindow::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!");
}

Here is the call graph for this function:

void PLearn::ParzenWindow::train ( ) [virtual]

trains the model

Reimplemented from PLearn::GaussMix.

Definition at line 107 of file ParzenWindow.cc.

References PLearn::GaussMix::alpha, build(), PLearn::GaussMix::center, PLearn::GaussMix::D, PLearn::VMat::getExample(), i, isotropic_sigma, PLearn::GaussMix::L, PLearn::VMat::length(), PLearn::GaussMix::resizeDataBeforeTraining(), PLearn::GaussMix::sigma, PLearn::PLearner::stage, PLearn::PLearner::train_set, and PLearn::GaussMix::type.

{
    if(stage<1)
    {
        int l = train_set.length();
        type = "spherical";
        L = l;
        D = -1;
        GaussMix::build();  // rebuild because options chnged
        resizeDataBeforeTraining(); // TODO See exactly what this does.
    
        // new code proprly taking sample weights into account
        bool has_weights = train_set->hasWeights();
        real default_weight = 1.0/l;
        Vec target;    
        real weight = 0;
        real weight_sum = 0;
    
        for(int i=0; i<l; i++)
        {
            // if(i%100==0)
            //    cerr << "[SEQUENTIAL TRAIN: processing pattern #" << i << "/" << l << "]\n";            
            Vec input = center(i);
            train_set->getExample(i,input,target,weight);
            sigma[i] = isotropic_sigma;
            if(has_weights)
            {
                alpha[i] = weight;
                weight_sum += weight;
            }
            else
                alpha[i] = default_weight;
            // resizeStuffBeforeTraining(); TODO Put back?
        }
        if(has_weights)
            alpha /= weight_sum;
        GaussMix::build();
        
        stage = 1;
        // precomputeStuff(); TODO Put back?
        build(); // rebuild
    }
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::GaussMix.

Definition at line 100 of file ParzenWindow.h.

Definition at line 59 of file ParzenWindow.h.

Referenced by declareOptions(), and train().


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