PLearn 0.1
|
#include <ParzenWindow.h>
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 OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual ParzenWindow * | deepCopy (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 PPath & | declaringFile () |
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. |
Definition at line 44 of file ParzenWindow.h.
typedef GaussMix PLearn::ParzenWindow::inherited [private] |
Reimplemented from PLearn::GaussMix.
Definition at line 49 of file ParzenWindow.h.
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) { }
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.
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().
{ inherited::build(); build_(); }
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().
{}
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); }
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!"); }
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 } }
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().