PLearn 0.1
|
[x1,x2,x3,...,xn] -> [f(x1), f(x3), ..., f(xn)] with f(x) = (max-min)*x - min and with n even It is the inverse of ProbabilityPairsVariable More...
#include <ProbabilityPairsInverseVariable.h>
Public Member Functions | |
ProbabilityPairsInverseVariable () | |
Default constructor, usually does nothing. | |
ProbabilityPairsInverseVariable (Variable *input, real min, real max) | |
ProbabilityPairsInverseVariable (Variable *input, real max) | |
ProbabilityPairsInverseVariable (Variable *input) | |
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 ProbabilityPairsInverseVariable * | 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_ () |
ProbabilityPairsInverseVariable. | |
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 | min |
### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //! | |
real | max |
see ProbabilityPairsVariable documentation | |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Private Types | |
typedef UnaryVariable | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
[x1,x2,x3,...,xn] -> [f(x1), f(x3), ..., f(xn)] with f(x) = (max-min)*x - min and with n even It is the inverse of ProbabilityPairsVariable
* ProbabilityPairsInverseVariable *
Definition at line 61 of file ProbabilityPairsInverseVariable.h.
typedef UnaryVariable PLearn::ProbabilityPairsInverseVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 63 of file ProbabilityPairsInverseVariable.h.
PLearn::ProbabilityPairsInverseVariable::ProbabilityPairsInverseVariable | ( | ) |
Default constructor, usually does nothing.
Definition at line 54 of file ProbabilityPairsInverseVariable.cc.
PLearn::ProbabilityPairsInverseVariable::ProbabilityPairsInverseVariable | ( | Variable * | input | ) |
string PLearn::ProbabilityPairsInverseVariable::_classname_ | ( | ) | [static] |
ProbabilityPairsInverseVariable.
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
OptionList & PLearn::ProbabilityPairsInverseVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
RemoteMethodMap & PLearn::ProbabilityPairsInverseVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
Object * PLearn::ProbabilityPairsInverseVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
StaticInitializer ProbabilityPairsInverseVariable::_static_initializer_ & PLearn::ProbabilityPairsInverseVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
void PLearn::ProbabilityPairsInverseVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 97 of file ProbabilityPairsInverseVariable.cc.
References i, PLearn::UnaryVariable::input, PLearn::Var::length(), PLearn::Variable::matGradient, max, min, n, and PLearn::Var::width().
{ for(int n=0; n<input->length(); n++) for(int i=0; i<input->width()/2; i++) input->matGradient(n,i*2) += matGradient(n,i)*(max-min); }
void PLearn::ProbabilityPairsInverseVariable::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 111 of file ProbabilityPairsInverseVariable.cc.
References PLearn::UnaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::ProbabilityPairsInverseVariable::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::UnaryVariable.
Definition at line 154 of file ProbabilityPairsInverseVariable.cc.
Referenced by build(), and ProbabilityPairsInverseVariable().
{ // ### 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::ProbabilityPairsInverseVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
void PLearn::ProbabilityPairsInverseVariable::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::UnaryVariable.
Definition at line 131 of file ProbabilityPairsInverseVariable.cc.
References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::UnaryVariable::declareOptions(), max, and min.
{ // ### 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, "min", &ProbabilityPairsInverseVariable::min, OptionBase::buildoption, "The lower bound a value of the input should be. It will be used to calculate the corresponding probability of each input."); declareOption(ol, "max", &ProbabilityPairsInverseVariable::max, OptionBase::buildoption, "analog to min"); // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::ProbabilityPairsInverseVariable::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 104 of file ProbabilityPairsInverseVariable.h.
:
//##### Protected Options ###############################################
ProbabilityPairsInverseVariable * PLearn::ProbabilityPairsInverseVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
void PLearn::ProbabilityPairsInverseVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 89 of file ProbabilityPairsInverseVariable.cc.
References i, PLearn::UnaryVariable::input, PLearn::Var::length(), PLearn::Variable::matValue, max, min, n, and PLearn::Var::width().
{ for(int n=0; n<input->length(); n++) for(int i=0; i<input->width()/2; i++) matValue(n,i) = input->matValue(n,i*2)*(max-min) + min; }
OptionList & PLearn::ProbabilityPairsInverseVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
OptionMap & PLearn::ProbabilityPairsInverseVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
RemoteMethodMap & PLearn::ProbabilityPairsInverseVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 51 of file ProbabilityPairsInverseVariable.cc.
void PLearn::ProbabilityPairsInverseVariable::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::UnaryVariable.
Definition at line 117 of file ProbabilityPairsInverseVariable.cc.
References PLearn::UnaryVariable::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); // ### 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 79 of file ProbabilityPairsInverseVariable.cc.
References PLearn::UnaryVariable::input, PLearn::Var::length(), and PLearn::Var::width().
{ if (input) { l = input->length(); // the computed length of this Var w = input->width()/2; // the computed width } else l = w = 0; }
Reimplemented from PLearn::UnaryVariable.
Definition at line 104 of file ProbabilityPairsInverseVariable.h.
see ProbabilityPairsVariable documentation
Definition at line 75 of file ProbabilityPairsInverseVariable.h.
Referenced by bprop(), declareOptions(), and fprop().
### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //!
see ProbabilityPairsVariable documentation
Definition at line 72 of file ProbabilityPairsInverseVariable.h.
Referenced by bprop(), declareOptions(), and fprop().