PLearn 0.1
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Member Functions | Private Types | Private Member Functions
PLearn::ProbabilityPairsInverseVariable Class Reference

[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>

Inheritance diagram for PLearn::ProbabilityPairsInverseVariable:
Inheritance graph
[legend]
Collaboration diagram for PLearn::ProbabilityPairsInverseVariable:
Collaboration graph
[legend]

List of all members.

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 OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () 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 PPathdeclaringFile ()

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.

Detailed Description

[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 *

Todo:
Write class to-do's here if there are any.
Deprecated:
Write deprecated stuff here if there is any. Indicate what else should be used instead.

Definition at line 61 of file ProbabilityPairsInverseVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 63 of file ProbabilityPairsInverseVariable.h.


Constructor & Destructor Documentation

PLearn::ProbabilityPairsInverseVariable::ProbabilityPairsInverseVariable ( )

Default constructor, usually does nothing.

Definition at line 54 of file ProbabilityPairsInverseVariable.cc.

    : min(0.), max(1.)
{}
PLearn::ProbabilityPairsInverseVariable::ProbabilityPairsInverseVariable ( Variable input,
real  min,
real  max 
)

Definition at line 58 of file ProbabilityPairsInverseVariable.cc.

References build_().

    : inherited(input, input->length(), input->width()/2),
      min(min),max(max)
{
    build_();
}

Here is the call graph for this function:

PLearn::ProbabilityPairsInverseVariable::ProbabilityPairsInverseVariable ( Variable input,
real  max 
)

Definition at line 65 of file ProbabilityPairsInverseVariable.cc.

References build_().

    :inherited(input, input->length(), input->width()/2),
     min(0.), max(max)
{
    build_();
}

Here is the call graph for this function:

PLearn::ProbabilityPairsInverseVariable::ProbabilityPairsInverseVariable ( Variable input)

Definition at line 72 of file ProbabilityPairsInverseVariable.cc.

References build_().

    :inherited(input, input->length(), input->width()/2),
     min(0.), max(1.)
{
    build_();
}

Here is the call graph for this function:


Member Function Documentation

string PLearn::ProbabilityPairsInverseVariable::_classname_ ( ) [static]
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.

bool PLearn::ProbabilityPairsInverseVariable::_isa_ ( const Object o) [static]

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);
}

Here is the call graph for this function:

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_().

Here is the call graph for this function:

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.
}

Here is the caller graph for this function:

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);
}

Here is the call graph for this function:

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;
}

Here is the call graph for this function:

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);
}

Here is the call graph for this function:

void PLearn::ProbabilityPairsInverseVariable::recomputeSize ( int l,
int w 
) const [virtual]

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;
}

Here is the call graph for this function:


Member Data Documentation

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().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines