PLearn 0.1
|
#include <SpiralDistribution.h>
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 OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual SpiralDistribution * | deepCopy (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 PPath & | declaringFile () |
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. |
Definition at line 49 of file SpiralDistribution.h.
Reimplemented from PLearn::UnconditionalDistribution.
Definition at line 53 of file SpiralDistribution.h.
PLearn::SpiralDistribution::SpiralDistribution | ( | ) |
Definition at line 46 of file SpiralDistribution.cc.
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.
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_().
{ inherited::build(); build_(); }
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(); }
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.
computes (x,y) = ( lambda*sin(alpha*t), lambda*cos(alpha*t) )
Definition at line 129 of file SpiralDistribution.cc.
Referenced by generate().
void PLearn::SpiralDistribution::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares this class' options.
Reimplemented from PLearn::UnconditionalDistribution.
Definition at line 64 of file SpiralDistribution.cc.
References alpha, PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::UnconditionalDistribution::declareOptions(), include_t, lambda, sigma, tmax, tmin, and uniformity.
{ declareOption(ol, "lambda", &SpiralDistribution::lambda, OptionBase::buildoption,""); declareOption(ol, "alpha", &SpiralDistribution::alpha, OptionBase::buildoption,""); declareOption(ol, "tmin", &SpiralDistribution::tmin, OptionBase::buildoption,""); declareOption(ol, "tmax", &SpiralDistribution::tmax, OptionBase::buildoption,""); declareOption(ol, "sigma", &SpiralDistribution::sigma, OptionBase::buildoption,""); declareOption(ol, "uniformity", &SpiralDistribution::uniformity, OptionBase::buildoption,""); declareOption(ol, "include_t", &SpiralDistribution::include_t, OptionBase::buildoption, "If true, then t will be appended to the generated sample, along with x and y."); inherited::declareOptions(ol); }
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; }
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; }
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!"); }
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] |
Reimplemented from PLearn::PDistribution.
Definition at line 126 of file SpiralDistribution.cc.
References PLERROR.
{ PLERROR("variance not implemented for SpiralDistribution"); }
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().