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

#include <Binner.h>

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

List of all members.

Public Types

typedef Object inherited

Public Member Functions

 Binner ()
virtual void build ()
 Post-constructor.
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.
virtual int nBins () const
 Return the number of bins computed by this binner.
virtual PP< RealMappinggetBinning (VMat v) const
 Returns a binning for a single column vmatrix v.
virtual TVec< TVec< int > > getBins (const Vec &v) const
 Return a vector whose i-th element is the list of the indices in 'v' that belong to the i-th bin.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual BinnerdeepCopy (CopiesMap &copies) const

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

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares this class' options.

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 54 of file Binner.h.


Member Typedef Documentation

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 66 of file Binner.h.


Constructor & Destructor Documentation

PLearn::Binner::Binner ( )

Definition at line 52 of file Binner.cc.

    :Object()
{}

Member Function Documentation

string PLearn::Binner::_classname_ ( ) [static]

Declares name and deepCopy methods.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

OptionList & PLearn::Binner::_getOptionList_ ( ) [static]

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

RemoteMethodMap & PLearn::Binner::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

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

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

Object * PLearn::Binner::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

StaticInitializer Binner::_static_initializer_ & PLearn::Binner::_static_initialize_ ( ) [static]

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

void PLearn::Binner::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::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 89 of file Binner.cc.

References PLearn::Object::build(), and build_().

Referenced by PLearn::ManualBinner::build().

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::Binner::build_ ( ) [private]

This does the actual building.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 77 of file Binner.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.
}

Here is the caller graph for this function:

string PLearn::Binner::classname ( ) const [virtual]

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

void PLearn::Binner::declareOptions ( OptionList ol) [static, protected]

Declares this class' options.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 60 of file Binner.cc.

References PLearn::Object::declareOptions().

Referenced by PLearn::ManualBinner::declareOptions().

{
    // ### 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. Another possible flag to be combined with
    // ### is OptionBase::nosave

    // ### ex:
    // declareOption(ol, "myoption", &Binner::myoption, OptionBase::buildoption,
    //               "Help text describing this option");
    // ...

    // Now call the parent class' declareOptions
    inherited::declareOptions(ol);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const PPath& PLearn::Binner::declaringFile ( ) [inline, static]

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 118 of file Binner.h.

Binner * PLearn::Binner::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

PP< RealMapping > PLearn::Binner::getBinning ( VMat  v) const [virtual]

Returns a binning for a single column vmatrix v.

Reimplemented in PLearn::ManualBinner.

Definition at line 113 of file Binner.cc.

References PLERROR.

Referenced by getBins().

{ PLERROR("getBinning not implemented for this Binner"); return 0; }

Here is the caller graph for this function:

TVec< TVec< int > > PLearn::Binner::getBins ( const Vec v) const [virtual]

Return a vector whose i-th element is the list of the indices in 'v' that belong to the i-th bin.

This method does not need to be written in subclasses (in general), as long as 'getBinning()' is implemented.

Reimplemented in PLearn::SoftHistogramBinner.

Definition at line 119 of file Binner.cc.

References PLearn::TVec< T >::append(), PLearn::columnmatrix(), getBinning(), i, PLearn::TVec< T >::length(), and PLWARNING.

                                                    {
    PLWARNING("In Binner::getBins - This method has not been tested yet, remove this warning if it works fine");
    VMat col = new MemoryVMatrix(columnmatrix(v));
    PP<RealMapping> mapping = getBinning(col);
    TVec< TVec<int> > bins(mapping->length());
    for (int i = 0; i < v.length(); i++) {
        bins[mapping->binnumber(v[i])].append(i);
    }
    return bins;
}

Here is the call graph for this function:

OptionList & PLearn::Binner::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

OptionMap & PLearn::Binner::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

RemoteMethodMap & PLearn::Binner::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 58 of file Binner.cc.

void PLearn::Binner::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 96 of file Binner.cc.

References PLearn::Object::makeDeepCopyFromShallowCopy(), and PLERROR.

Referenced by PLearn::ManualBinner::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);

    // ### Remove this line when you have fully implemented this method.
    PLERROR("Binner::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int PLearn::Binner::nBins ( ) const [virtual]

Return the number of bins computed by this binner.

Default implementation displays an error.

Reimplemented in PLearn::SoftHistogramBinner.

Definition at line 133 of file Binner.cc.

References PLERROR.

                        {
    PLERROR("In Binner::nBins - The nBins() method is not available for this Binner.");
    return 0;
}

Member Data Documentation

Reimplemented from PLearn::Object.

Reimplemented in PLearn::ManualBinner, and PLearn::SoftHistogramBinner.

Definition at line 118 of file Binner.h.


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