PLearn 0.1
|
The first sentence should be a BRIEF DESCRIPTION of what the class does. More...
#include <StochasticBinarizeVMatrix.h>
Public Member Functions | |
StochasticBinarizeVMatrix () | |
Default constructor. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual StochasticBinarizeVMatrix * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Simply calls inherited::build() then build_(). | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
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 | rescale_to_0_1 |
int | seed |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Member Functions | |
virtual void | getNewRow (int i, const Vec &v) const |
Fill the vector 'v' with the content of the i-th row. | |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Protected Attributes | |
PP< PRandom > | random_gen |
VMat | rescaled_data |
Private Types | |
typedef SourceVMatrix | 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 58 of file StochasticBinarizeVMatrix.h.
typedef SourceVMatrix PLearn::StochasticBinarizeVMatrix::inherited [private] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 60 of file StochasticBinarizeVMatrix.h.
PLearn::StochasticBinarizeVMatrix::StochasticBinarizeVMatrix | ( | ) |
Default constructor.
Definition at line 61 of file StochasticBinarizeVMatrix.cc.
: rescale_to_0_1(true), seed(1827), random_gen(new PRandom()) { }
string PLearn::StochasticBinarizeVMatrix::_classname_ | ( | ) | [static] |
Declares name and deepCopy methods.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
OptionList & PLearn::StochasticBinarizeVMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
RemoteMethodMap & PLearn::StochasticBinarizeVMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
Object * PLearn::StochasticBinarizeVMatrix::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
StaticInitializer StochasticBinarizeVMatrix::_static_initializer_ & PLearn::StochasticBinarizeVMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
void PLearn::StochasticBinarizeVMatrix::build | ( | ) | [virtual] |
Simply calls inherited::build() then build_().
Reimplemented from PLearn::SourceVMatrix.
Definition at line 91 of file StochasticBinarizeVMatrix.cc.
References PLearn::SourceVMatrix::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::StochasticBinarizeVMatrix::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 100 of file StochasticBinarizeVMatrix.cc.
References PLearn::get_pointer(), random_gen, rescale_to_0_1, rescaled_data, seed, PLearn::SourceVMatrix::setMetaInfoFromSource(), and PLearn::SourceVMatrix::source.
Referenced by build().
{ if (source) { if (rescale_to_0_1) { PP<ShiftAndRescaleVMatrix> rd = new ShiftAndRescaleVMatrix(source, false); rd->min_max = Vec(2); rd->min_max[1] = 1; rd->build(); rescaled_data = get_pointer(rd); } else rescaled_data = source; setMetaInfoFromSource(); } random_gen->manual_seed(seed); }
string PLearn::StochasticBinarizeVMatrix::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
void PLearn::StochasticBinarizeVMatrix::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 71 of file StochasticBinarizeVMatrix.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::SourceVMatrix::declareOptions(), rescale_to_0_1, and seed.
{ declareOption(ol, "rescale_to_0_1", &StochasticBinarizeVMatrix::rescale_to_0_1, OptionBase::buildoption, "Whether to rescale to [0,1] before sampling. If set to False, then\n" "the data is assumed to already be in the [0,1] range (no check will\n" "be performed to enforce it, though)."); declareOption(ol, "seed", &StochasticBinarizeVMatrix::seed, OptionBase::buildoption, "Seed of random number generator."); // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::StochasticBinarizeVMatrix::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 77 of file StochasticBinarizeVMatrix.h.
:
StochasticBinarizeVMatrix * PLearn::StochasticBinarizeVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
void PLearn::StochasticBinarizeVMatrix::getNewRow | ( | int | i, |
const Vec & | v | ||
) | const [protected, virtual] |
Fill the vector 'v' with the content of the i-th row.
v is assumed to be the right size.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 120 of file StochasticBinarizeVMatrix.cc.
References j, random_gen, rescaled_data, and PLearn::SourceVMatrix::source.
{ rescaled_data->getRow(i, v); for (int j = 0; j < source->inputsize(); j++) v[j] = random_gen->uniform_sample() <= v[j] ? 1 : 0; }
OptionList & PLearn::StochasticBinarizeVMatrix::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
OptionMap & PLearn::StochasticBinarizeVMatrix::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
RemoteMethodMap & PLearn::StochasticBinarizeVMatrix::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file StochasticBinarizeVMatrix.cc.
void PLearn::StochasticBinarizeVMatrix::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 130 of file StochasticBinarizeVMatrix.cc.
References PLearn::SourceVMatrix::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("StochasticBinarizeVMatrix::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!"); }
Reimplemented from PLearn::SourceVMatrix.
Definition at line 77 of file StochasticBinarizeVMatrix.h.
PP<PRandom> PLearn::StochasticBinarizeVMatrix::random_gen [protected] |
Definition at line 87 of file StochasticBinarizeVMatrix.h.
Referenced by build_(), and getNewRow().
Definition at line 65 of file StochasticBinarizeVMatrix.h.
Referenced by build_(), and declareOptions().
VMat PLearn::StochasticBinarizeVMatrix::rescaled_data [protected] |
Definition at line 88 of file StochasticBinarizeVMatrix.h.
Referenced by build_(), and getNewRow().
Definition at line 66 of file StochasticBinarizeVMatrix.h.
Referenced by build_(), and declareOptions().