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

The first sentence should be a BRIEF DESCRIPTION of what the class does. More...

#include <StochasticBinarizeVMatrix.h>

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

List of all members.

Public Member Functions

 StochasticBinarizeVMatrix ()
 Default constructor.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual StochasticBinarizeVMatrixdeepCopy (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 PPathdeclaringFile ()

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< PRandomrandom_gen
VMat rescaled_data

Private Types

typedef SourceVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

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

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 58 of file StochasticBinarizeVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::SourceVMatrix.

Definition at line 60 of file StochasticBinarizeVMatrix.h.


Constructor & Destructor Documentation

PLearn::StochasticBinarizeVMatrix::StochasticBinarizeVMatrix ( )

Default constructor.

Definition at line 61 of file StochasticBinarizeVMatrix.cc.

                                                    :
    rescale_to_0_1(true),
    seed(1827),
    random_gen(new PRandom())
{
}

Member Function Documentation

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.

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

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

Here is the call graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

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

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::SourceVMatrix.

Definition at line 77 of file StochasticBinarizeVMatrix.h.

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

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


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