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

#include <SpiralDistribution.h>

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

List of all members.

Public Types

typedef UnconditionalDistribution inherited

Public Member Functions

 SpiralDistribution ()
virtual void build ()
 simply calls inherited::build() then build_()
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual SpiralDistributiondeepCopy (CopiesMap &copies) const
void curve (real t, real &x, real &y) const
 computes (x,y) = ( lambda*sin(alpha*t), lambda*cos(alpha*t) )
virtual real log_density (const Vec &x) const
 return log of probability density log(p(x))
virtual real survival_fn (const Vec &x) const
 return survival fn = P(X>x)
virtual real cdf (const Vec &x) const
 return survival fn = P(X<x)
virtual void expectation (Vec &mu) const
 return E[X]
virtual void variance (Mat &cov) const
 return Var[X]
virtual void generate (Vec &x) const
 return a pseudo-random sample generated from the distribution.
virtual int inputsize () const
 inputsize is 2 (or 3 if include_t is set to true)

Static Public Member Functions

static string _classname_ ()
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 lambda
real alpha
real tmin
real tmax
real sigma
real uniformity
bool include_t

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 49 of file SpiralDistribution.h.


Member Typedef Documentation

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 53 of file SpiralDistribution.h.


Constructor & Destructor Documentation

PLearn::SpiralDistribution::SpiralDistribution ( )

Definition at line 46 of file SpiralDistribution.cc.

    : lambda(0.04),
      alpha(1),
      tmin(3),
      tmax(15),
      sigma(0.01),
      uniformity(1),
      include_t(false)
{
    // build_();
}

Member Function Documentation

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

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

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

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

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

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

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

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

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

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

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

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

void PLearn::SpiralDistribution::build ( ) [virtual]

simply calls inherited::build() then build_()

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 94 of file SpiralDistribution.cc.

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

Here is the call graph for this function:

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

This does the actual building.

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 78 of file SpiralDistribution.cc.

References PLearn::UnconditionalDistribution::build(), inputsize(), and PLearn::PDistribution::predicted_size.

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.
    
    // annoying stuff due to conditional distribution (silly, fix this some day)
    predicted_size = inputsize();
    inherited::build();
}

Here is the call graph for this function:

Here is the caller graph for this function:

real PLearn::SpiralDistribution::cdf ( const Vec x) const [virtual]

return survival fn = P(X<x)

Reimplemented from PLearn::PDistribution.

Definition at line 120 of file SpiralDistribution.cc.

References PLERROR.

{ PLERROR("cdf not implemented for SpiralDistribution"); return 0; }
string PLearn::SpiralDistribution::classname ( ) const [virtual]

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

void PLearn::SpiralDistribution::curve ( real  t,
real x,
real y 
) const

computes (x,y) = ( lambda*sin(alpha*t), lambda*cos(alpha*t) )

Definition at line 129 of file SpiralDistribution.cc.

References alpha, and lambda.

Referenced by generate().

{
    x = lambda*t*sin(alpha*t);
    y = lambda*t*cos(alpha*t);
}

Here is the caller graph for this function:

void PLearn::SpiralDistribution::declareOptions ( OptionList ol) [static, protected]
static const PPath& PLearn::SpiralDistribution::declaringFile ( ) [inline, static]

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 106 of file SpiralDistribution.h.

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

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

void PLearn::SpiralDistribution::expectation ( Vec mu) const [virtual]

return E[X]

Reimplemented from PLearn::PDistribution.

Definition at line 123 of file SpiralDistribution.cc.

References PLERROR.

{ PLERROR("expectation not implemented for SpiralDistribution"); }
void PLearn::SpiralDistribution::generate ( Vec x) const [virtual]

return a pseudo-random sample generated from the distribution.

Reimplemented from PLearn::PDistribution.

Definition at line 135 of file SpiralDistribution.cc.

References curve(), PLearn::fast_is_equal(), inputsize(), PLearn::pow(), PLearn::PLearner::random_gen, PLearn::TVec< T >::resize(), sigma, tmax, tmin, u, uniformity, and x.

{
    v.resize(inputsize());

    real x, y;
    real u =  random_gen->bounded_uniform(0,1);
    real t = (fast_is_equal(uniformity, 1))?u:pow(u,uniformity);
    t = tmin+(tmax-tmin)*t;
    curve(t,x,y);
    x += random_gen->gaussian_mu_sigma(0, sigma);
    y += random_gen->gaussian_mu_sigma(0, sigma);

    v[0] = x;
    v[1] = y;
    if(inputsize()==3)
        v[2] = t;
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

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

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

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

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 62 of file SpiralDistribution.cc.

int PLearn::SpiralDistribution::inputsize ( ) const [virtual]

inputsize is 2 (or 3 if include_t is set to true)

Reimplemented from PLearn::PLearner.

Definition at line 157 of file SpiralDistribution.cc.

References include_t.

Referenced by build_(), and generate().

{ return include_t ?3 :2; }

Here is the caller graph for this function:

real PLearn::SpiralDistribution::log_density ( const Vec x) const [virtual]

return log of probability density log(p(x))

Reimplemented from PLearn::PDistribution.

Definition at line 114 of file SpiralDistribution.cc.

References PLERROR.

{ PLERROR("density not implemented for SpiralDistribution"); return 0; }
void PLearn::SpiralDistribution::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 100 of file SpiralDistribution.cc.

References PLearn::UnconditionalDistribution::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("SpiralDistribution::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!");
}

Here is the call graph for this function:

real PLearn::SpiralDistribution::survival_fn ( const Vec x) const [virtual]

return survival fn = P(X>x)

Reimplemented from PLearn::PDistribution.

Definition at line 117 of file SpiralDistribution.cc.

References PLERROR.

{ PLERROR("survival_fn not implemented for SpiralDistribution"); return 0; }
void PLearn::SpiralDistribution::variance ( Mat cov) const [virtual]

return Var[X]

Reimplemented from PLearn::PDistribution.

Definition at line 126 of file SpiralDistribution.cc.

References PLERROR.

{ PLERROR("variance not implemented for SpiralDistribution"); }

Member Data Documentation

Reimplemented from PLearn::UnconditionalDistribution.

Definition at line 106 of file SpiralDistribution.h.

Definition at line 62 of file SpiralDistribution.h.

Referenced by curve(), and declareOptions().

Definition at line 67 of file SpiralDistribution.h.

Referenced by declareOptions(), and inputsize().

Definition at line 61 of file SpiralDistribution.h.

Referenced by curve(), and declareOptions().

Definition at line 65 of file SpiralDistribution.h.

Referenced by declareOptions(), and generate().

Definition at line 64 of file SpiralDistribution.h.

Referenced by declareOptions(), and generate().

Definition at line 63 of file SpiralDistribution.h.

Referenced by declareOptions(), and generate().

Definition at line 66 of file SpiralDistribution.h.

Referenced by declareOptions(), and generate().


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