PLearn 0.1
|
The first sentence should be a BRIEF DESCRIPTION of what the class does. More...
#include <AdditiveGaussianNoiseVariable.h>
Public Member Functions | |
AdditiveGaussianNoiseVariable () | |
Default constructor, usually does nothing. | |
virtual void | recomputeSize (int &l, int &w) const |
Recomputes the length l and width w that this variable should have, according to its parent variables. | |
virtual void | fprop () |
Nothing to do by default. | |
virtual void | bprop () |
Nothing to do by default. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual AdditiveGaussianNoiseVariable * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Post-constructor. | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
Static Public Member Functions | |
static string | _classname_ () |
AdditiveGaussianNoiseVariable. | |
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 | |
PP< PRandom > | random_gen |
### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //! | |
real | sigma |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Protected Attributes | |
TVec< bool > | corrupted |
Private Types | |
typedef UnaryVariable | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
The first sentence should be a BRIEF DESCRIPTION of what the class does.
* AdditiveGaussianNoiseVariable * Place the rest of the class programmer documentation here. Doxygen supports Javadoc-style comments. See http://www.doxygen.org/manual.html
Definition at line 61 of file AdditiveGaussianNoiseVariable.h.
typedef UnaryVariable PLearn::AdditiveGaussianNoiseVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 63 of file AdditiveGaussianNoiseVariable.h.
PLearn::AdditiveGaussianNoiseVariable::AdditiveGaussianNoiseVariable | ( | ) |
Default constructor, usually does nothing.
Definition at line 53 of file AdditiveGaussianNoiseVariable.cc.
:sigma(1) { // ### You may (or not) want to call build_() to finish building the object // ### (doing so assumes the parent classes' build_() have been called too // ### in the parent classes' constructors, something that you must ensure) }
string PLearn::AdditiveGaussianNoiseVariable::_classname_ | ( | ) | [static] |
AdditiveGaussianNoiseVariable.
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
OptionList & PLearn::AdditiveGaussianNoiseVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
RemoteMethodMap & PLearn::AdditiveGaussianNoiseVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
Object * PLearn::AdditiveGaussianNoiseVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
StaticInitializer AdditiveGaussianNoiseVariable::_static_initializer_ & PLearn::AdditiveGaussianNoiseVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
void PLearn::AdditiveGaussianNoiseVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 99 of file AdditiveGaussianNoiseVariable.cc.
{ }
void PLearn::AdditiveGaussianNoiseVariable::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::UnaryVariable.
Definition at line 110 of file AdditiveGaussianNoiseVariable.cc.
References PLearn::UnaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::AdditiveGaussianNoiseVariable::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::UnaryVariable.
Definition at line 151 of file AdditiveGaussianNoiseVariable.cc.
Referenced by build().
{ // ### 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::AdditiveGaussianNoiseVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
void PLearn::AdditiveGaussianNoiseVariable::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::UnaryVariable.
Definition at line 130 of file AdditiveGaussianNoiseVariable.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::UnaryVariable::declareOptions(), random_gen, and sigma.
{ // ### 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, "sigma", &AdditiveGaussianNoiseVariable::sigma, OptionBase::buildoption, "The standard deviation of the isotropic Gaussian noise to be added to the input"); declareOption(ol, "random_gen", &AdditiveGaussianNoiseVariable::random_gen, OptionBase::buildoption, "Random number generator. If null, the PRandom::common(false) generator will be used."); // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::AdditiveGaussianNoiseVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 101 of file AdditiveGaussianNoiseVariable.h.
:
//##### Protected Options ###############################################
AdditiveGaussianNoiseVariable * PLearn::AdditiveGaussianNoiseVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
void PLearn::AdditiveGaussianNoiseVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 84 of file AdditiveGaussianNoiseVariable.cc.
References PLearn::UnaryVariable::checkContiguity(), PLearn::PRandom::common(), i, PLearn::UnaryVariable::input, PLearn::PP< T >::isNull(), PLearn::TVec< T >::length(), n, random_gen, sigma, PLearn::Variable::value, and PLearn::Variable::valuedata.
{ checkContiguity(); if(random_gen.isNull()) random_gen = PRandom::common(false); int n = value.length(); for(int i=0; i<n; i++) { valuedata[i] = random_gen->gaussian_mu_sigma(input->valuedata[i], sigma); } }
OptionList & PLearn::AdditiveGaussianNoiseVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
OptionMap & PLearn::AdditiveGaussianNoiseVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
RemoteMethodMap & PLearn::AdditiveGaussianNoiseVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file AdditiveGaussianNoiseVariable.cc.
void PLearn::AdditiveGaussianNoiseVariable::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::UnaryVariable.
Definition at line 116 of file AdditiveGaussianNoiseVariable.cc.
References PLearn::deepCopyField(), PLearn::UnaryVariable::makeDeepCopyFromShallowCopy(), and random_gen.
{ inherited::makeDeepCopyFromShallowCopy(copies); // ### Call deepCopyField on all "pointer-like" fields // ### that you wish to be deepCopied rather than // ### shallow-copied. // ### ex: deepCopyField(random_gen, copies); // ### If you want to deepCopy a Var field: // varDeepCopyField(somevariable, copies); }
Recomputes the length l and width w that this variable should have, according to its parent variables.
This is used for ex. by sizeprop() The default version stupidly returns the current dimensions, so make sure to overload it in subclasses if this is not appropriate.
Reimplemented from PLearn::Variable.
Definition at line 72 of file AdditiveGaussianNoiseVariable.cc.
References PLearn::UnaryVariable::input, PLearn::Var::length(), and PLearn::Var::width().
Reimplemented from PLearn::UnaryVariable.
Definition at line 101 of file AdditiveGaussianNoiseVariable.h.
TVec<bool> PLearn::AdditiveGaussianNoiseVariable::corrupted [protected] |
Definition at line 117 of file AdditiveGaussianNoiseVariable.h.
### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //!
Definition at line 70 of file AdditiveGaussianNoiseVariable.h.
Referenced by declareOptions(), fprop(), and makeDeepCopyFromShallowCopy().
Definition at line 71 of file AdditiveGaussianNoiseVariable.h.
Referenced by declareOptions(), and fprop().