PLearn 0.1
|
#include <ShuffleColumnsVMatrix.h>
Public Member Functions | |
ShuffleColumnsVMatrix () | |
Default constructor. | |
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 ShuffleColumnsVMatrix * | deepCopy (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 PPath & | declaringFile () |
Public Attributes | |
bool | only_shuffle_inputs |
int32_t | seed |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares this class' options. | |
Private Types | |
typedef SelectColumnsVMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
Definition at line 52 of file ShuffleColumnsVMatrix.h.
typedef SelectColumnsVMatrix PLearn::ShuffleColumnsVMatrix::inherited [private] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 57 of file ShuffleColumnsVMatrix.h.
PLearn::ShuffleColumnsVMatrix::ShuffleColumnsVMatrix | ( | ) |
Default constructor.
Definition at line 53 of file ShuffleColumnsVMatrix.cc.
: only_shuffle_inputs(true), seed(0) {}
string PLearn::ShuffleColumnsVMatrix::_classname_ | ( | ) | [static] |
Declares name and deepCopy methods.
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
OptionList & PLearn::ShuffleColumnsVMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
RemoteMethodMap & PLearn::ShuffleColumnsVMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
Object * PLearn::ShuffleColumnsVMatrix::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
StaticInitializer ShuffleColumnsVMatrix::_static_initializer_ & PLearn::ShuffleColumnsVMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
void PLearn::ShuffleColumnsVMatrix::build | ( | ) | [virtual] |
Simply calls inherited::build() then build_().
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 87 of file ShuffleColumnsVMatrix.cc.
References PLearn::SelectColumnsVMatrix::build(), and build_().
{ // ### Nothing to add here, simply calls build_ inherited::build(); build_(); }
void PLearn::ShuffleColumnsVMatrix::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 97 of file ShuffleColumnsVMatrix.cc.
References PLearn::TVec< T >::append(), PLearn::SelectColumnsVMatrix::build(), i, PLearn::SelectColumnsVMatrix::indices, PLearn::manual_seed(), only_shuffle_inputs, PLERROR, seed, PLearn::shuffleElements(), PLearn::SourceVMatrix::source, PLearn::VMatrix::updateMtime(), and PLearn::VMat::width().
Referenced by build().
{ if (source) { updateMtime(source); int n_shuffle = source->width(); if (only_shuffle_inputs) { if (source->inputsize() < 0) PLERROR("In ShuffleColumnsVMatrix::build_ - Cannot find out the source inputsize"); n_shuffle = source->inputsize(); } indices = TVec<int>(0, n_shuffle - 1, 1); if (seed == -1) PLearn::seed(); else if (seed > 0) manual_seed(seed); else if (seed != 0) PLERROR("In ShuffleColumnsVMatrix::build_ - The seed must be either -1 or >= 0"); shuffleElements(indices); for (int i = 0; i < source->width() - n_shuffle; i++) { indices.append(i + n_shuffle); } } inherited::build(); }
string PLearn::ShuffleColumnsVMatrix::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
void PLearn::ShuffleColumnsVMatrix::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares this class' options.
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 66 of file ShuffleColumnsVMatrix.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::SelectColumnsVMatrix::declareOptions(), only_shuffle_inputs, and seed.
{ // ### 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, "only_shuffle_inputs", &ShuffleColumnsVMatrix::only_shuffle_inputs, OptionBase::buildoption, "Whether we should only shuffle the input part, or also shuffle the target and weight parts."); declareOption(ol, "seed", &ShuffleColumnsVMatrix::seed, OptionBase::buildoption, "The random generator seed (-1 = initialized from clock, 0 = no initialization)."); // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::ShuffleColumnsVMatrix::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 106 of file ShuffleColumnsVMatrix.h.
ShuffleColumnsVMatrix * PLearn::ShuffleColumnsVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
OptionList & PLearn::ShuffleColumnsVMatrix::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
OptionMap & PLearn::ShuffleColumnsVMatrix::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
RemoteMethodMap & PLearn::ShuffleColumnsVMatrix::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 61 of file ShuffleColumnsVMatrix.cc.
void PLearn::ShuffleColumnsVMatrix::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 125 of file ShuffleColumnsVMatrix.cc.
References PLearn::SelectColumnsVMatrix::makeDeepCopyFromShallowCopy(), and 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("ShuffleColumnsVMatrix::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!"); }
Reimplemented from PLearn::SelectColumnsVMatrix.
Definition at line 106 of file ShuffleColumnsVMatrix.h.
Definition at line 71 of file ShuffleColumnsVMatrix.h.
Referenced by build_(), and declareOptions().
Definition at line 72 of file ShuffleColumnsVMatrix.h.
Referenced by build_(), and declareOptions().