Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::Distribution Class Reference

#include <Distribution.h>

Inheritance diagram for PLearn::Distribution:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef Learner inherited

Public Member Functions

 Distribution ()
virtual void build ()
 **** SUBCLASS WRITING: **** This method should be redefined in subclasses, to just call inherited::build() and then build_()

virtual void makeDeepCopyFromShallowCopy (map< const void *, void * > &copies)
 Transforms a shallow copy into a deep copy.

 PLEARN_DECLARE_OBJECT (Distribution)
 Declares name and deepCopy methods.

virtual void train (VMat training_set)
 trains the model

virtual void use (const Vec &input, Vec &output)
 computes the ouptu of a trained model

virtual double log_density (const Vec &x) const
 return log of probability density log(p(x))

virtual double density (const Vec &x) const
 return probability density p(x) [ default version returns exp(log_density(x)) ]

virtual double survival_fn (const Vec &x) const
 return survival fn = P(X>x)

virtual double cdf (const Vec &x) const
 return survival fn = P(X<x)

virtual Vec expectation () const
 return E[X]

virtual Mat variance () const
 return Var[X]

virtual void generate (Vec &x) const
 return a pseudo-random sample generated from the distribution.


Public Attributes

string use_returns_what
 A string where the characters have the following meaning: 'l'->log_density, 'd' -> density, 'c' -> cdf, 's' -> survival_fn, 'e' -> expectation, 'v' -> variance.


Static Protected Member Functions

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


Private Member Functions

void build_ ()
 This does the actual building.


Member Typedef Documentation

typedef Learner PLearn::Distribution::inherited
 

Reimplemented from PLearn::Learner.

Reimplemented in PLearn::ConditionalDistribution, PLearn::ConditionalGaussianDistribution, PLearn::EmpiricalDistribution, and PLearn::LocallyWeightedDistribution.

Definition at line 64 of file Distribution.h.


Constructor & Destructor Documentation

PLearn::Distribution::Distribution  ) 
 

Definition at line 50 of file Distribution.cc.

References PLearn::neg_output_costfunc().


Member Function Documentation

void PLearn::Distribution::build  )  [virtual]
 

**** SUBCLASS WRITING: **** This method should be redefined in subclasses, to just call inherited::build() and then build_()

Reimplemented from PLearn::Learner.

Reimplemented in PLearn::ConditionalGaussianDistribution, and PLearn::LocallyWeightedDistribution.

Definition at line 91 of file Distribution.cc.

References build_().

void PLearn::Distribution::build_  )  [private]
 

This does the actual building.

Reimplemented from PLearn::Learner.

Reimplemented in PLearn::LocallyWeightedDistribution.

Definition at line 77 of file Distribution.cc.

References use_returns_what.

Referenced by build().

double PLearn::Distribution::cdf const Vec x  )  const [virtual]
 

return survival fn = P(X<x)

Reimplemented in PLearn::ConditionalGaussianDistribution, and PLearn::EmpiricalDistribution.

Definition at line 154 of file Distribution.cc.

References PLERROR.

Referenced by use().

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

Declares this class' options.

Reimplemented from PLearn::Learner.

Reimplemented in PLearn::ConditionalGaussianDistribution, PLearn::EmpiricalDistribution, and PLearn::LocallyWeightedDistribution.

Definition at line 61 of file Distribution.cc.

References PLearn::declareOption(), and PLearn::OptionList.

double PLearn::Distribution::density const Vec x  )  const [virtual]
 

return probability density p(x) [ default version returns exp(log_density(x)) ]

Reimplemented in PLearn::ConditionalGaussianDistribution.

Definition at line 148 of file Distribution.cc.

References PLearn::exp(), log_density(), and x.

Referenced by use().

Vec PLearn::Distribution::expectation  )  const [virtual]
 

return E[X]

Reimplemented in PLearn::ConditionalGaussianDistribution, and PLearn::EmpiricalDistribution.

Definition at line 157 of file Distribution.cc.

References PLERROR, and PLearn::Vec.

Referenced by PLearn::ConditionalDistribution::use().

void PLearn::Distribution::generate Vec x  )  const [virtual]
 

return a pseudo-random sample generated from the distribution.

Reimplemented in PLearn::ConditionalGaussianDistribution, and PLearn::EmpiricalDistribution.

Definition at line 163 of file Distribution.cc.

References PLERROR.

double PLearn::Distribution::log_density const Vec x  )  const [virtual]
 

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

Reimplemented in PLearn::ConditionalGaussianDistribution, PLearn::EmpiricalDistribution, and PLearn::LocallyWeightedDistribution.

Definition at line 145 of file Distribution.cc.

References PLERROR.

Referenced by density(), and use().

void PLearn::Distribution::makeDeepCopyFromShallowCopy map< const void *, void * > &  copies  )  [virtual]
 

Transforms a shallow copy into a deep copy.

Reimplemented in PLearn::ConditionalDistribution, PLearn::ConditionalGaussianDistribution, and PLearn::LocallyWeightedDistribution.

Definition at line 140 of file Distribution.cc.

PLearn::Distribution::PLEARN_DECLARE_OBJECT Distribution   ) 
 

Declares name and deepCopy methods.

double PLearn::Distribution::survival_fn const Vec x  )  const [virtual]
 

return survival fn = P(X>x)

Reimplemented in PLearn::ConditionalGaussianDistribution, and PLearn::EmpiricalDistribution.

Definition at line 151 of file Distribution.cc.

References PLERROR.

Referenced by use().

void PLearn::Distribution::train VMat  training_set  )  [virtual]
 

trains the model

Implements PLearn::Learner.

Reimplemented in PLearn::ConditionalGaussianDistribution, PLearn::EmpiricalDistribution, and PLearn::LocallyWeightedDistribution.

Definition at line 98 of file Distribution.cc.

References PLearn::Learner::inputsize(), PLERROR, PLearn::Learner::targetsize(), and PLearn::VMat::width().

void PLearn::Distribution::use const Vec input,
Vec output
[virtual]
 

computes the ouptu of a trained model

Implements PLearn::Learner.

Reimplemented in PLearn::ConditionalDistribution.

Definition at line 115 of file Distribution.cc.

References cdf(), density(), log_density(), PLERROR, survival_fn(), use_returns_what, and PLearn::Vec.

Mat PLearn::Distribution::variance  )  const [virtual]
 

return Var[X]

Reimplemented in PLearn::ConditionalGaussianDistribution, and PLearn::EmpiricalDistribution.

Definition at line 160 of file Distribution.cc.

References PLearn::Mat, and PLERROR.

Referenced by PLearn::ConditionalDistribution::use().


Member Data Documentation

string PLearn::Distribution::use_returns_what
 

A string where the characters have the following meaning: 'l'->log_density, 'd' -> density, 'c' -> cdf, 's' -> survival_fn, 'e' -> expectation, 'v' -> variance.

Definition at line 72 of file Distribution.h.

Referenced by build_(), and use().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:27:12 2004 for PLearn by doxygen 1.3.7