PLearn 0.1
|
The first sentence should be a BRIEF DESCRIPTION of what the class does. More...
#include <VariablesTest.h>
Public Member Functions | |
VariablesTest () | |
Default constructor. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual VariablesTest * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Post-constructor. | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
virtual void | perform () |
The method performing the test. | |
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 PPath & | declaringFile () |
Public Attributes | |
map< string, Mat > | results_mat |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Private Types | |
typedef PTest | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
The first sentence should be a BRIEF DESCRIPTION of what the class does.
Place the rest of the class programmer documentation here. Doxygen supports Javadoc-style comments. See http://www.doxygen.org/manual.html
Definition at line 57 of file VariablesTest.h.
typedef PTest PLearn::VariablesTest::inherited [private] |
Reimplemented from PLearn::PTest.
Definition at line 59 of file VariablesTest.h.
PLearn::VariablesTest::VariablesTest | ( | ) |
string PLearn::VariablesTest::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
OptionList & PLearn::VariablesTest::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
RemoteMethodMap & PLearn::VariablesTest::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
Object * PLearn::VariablesTest::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
StaticInitializer VariablesTest::_static_initializer_ & PLearn::VariablesTest::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
void PLearn::VariablesTest::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::PTest.
Definition at line 66 of file VariablesTest.cc.
{ inherited::build(); build_(); }
void PLearn::VariablesTest::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::PTest.
Definition at line 113 of file VariablesTest.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::VariablesTest::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
void PLearn::VariablesTest::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::PTest.
Definition at line 92 of file VariablesTest.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), and results_mat.
{ // ### 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. If you don't provide one of these three, // ### this option will be ignored when loading values from a script. // ### You can also combine flags, for example with OptionBase::nosave: // ### (OptionBase::buildoption | OptionBase::nosave) declareOption(ol, "results_mat", &VariablesTest::results_mat, OptionBase::buildoption, "Matrix test results."); // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::VariablesTest::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::PTest.
Definition at line 80 of file VariablesTest.h.
:
//##### Protected Options ###############################################
VariablesTest * PLearn::VariablesTest::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
OptionList & PLearn::VariablesTest::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
OptionMap & PLearn::VariablesTest::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
RemoteMethodMap & PLearn::VariablesTest::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::PTest.
Definition at line 54 of file VariablesTest.cc.
void PLearn::VariablesTest::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::PTest.
Definition at line 75 of file VariablesTest.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("VariablesTest::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!"); }
void PLearn::VariablesTest::perform | ( | ) | [virtual] |
The method performing the test.
A typical test consists in some output (to pout and / or perr), and updates of this object's options.
Reimplemented from PLearn::PTest.
Definition at line 130 of file VariablesTest.cc.
References PLearn::argmin(), PLearn::PRandom::common(), PLearn::Var::length(), PLearn::logadd(), and PLearn::Var::width().
{ // Declare and initialize variables used in tests. int is1 = 5; int n_input2 = 3; int n_input5 = 4; Var input1(1, is1, "input1"); Var input2(n_input2, is1, "input2"); PRandom::common(false)->fill_random_uniform(input2->matValue, -1, 1); Var input3(input2->length(), input2->width(), "input3"); PRandom::common(false)->fill_random_uniform(input3->matValue, -1, 1); Var input4(1, 1, "input4"); input4->matValue(0, 0) = 3; Var input5(n_input5, is1, "input5"); PRandom::common(false)->fill_random_uniform(input5->matValue, -1, 1); // Test UnfoldedFuncVariable to compute an argmin over a set of row vectors. Var argmin1 = argmin(input1); Func input1_to_argmin1(input1, argmin1); Var unfolded_argmin1 = new UnfoldedFuncVariable(input2, input1_to_argmin1, false); unfolded_argmin1->fprop(); results_mat["unfolded_argmin"] = unfolded_argmin1->matValue.copy(); // Test LogAddVariable to compute a logadd over two input matrices. Var logadd1 = logadd(input2, input3); logadd1->fprop(); results_mat["logadd_binary"] = logadd1->matValue.copy(); // Test LogAddVariable to compute a logadd over sub-columns of its first // input. Var logadd2 = new LogAddVariable(input5, input4, "per_row"); logadd2->fprop(); results_mat["logadd_per_row"] = logadd2->matValue.copy(); // Test LogAddVariable to compute a logadd over sub-rows of its first // input. Var logadd3 = new LogAddVariable(input5, input4, "per_column"); logadd3->fprop(); results_mat["logadd_per_column"] = logadd3->matValue.copy(); }
Reimplemented from PLearn::PTest.
Definition at line 80 of file VariablesTest.h.
map<string, Mat> PLearn::VariablesTest::results_mat |
Definition at line 64 of file VariablesTest.h.
Referenced by declareOptions().