PLearn 0.1
Public Member Functions
PLearn::StochasticRandomVariable Class Reference

#include <RandomVar.h>

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

List of all members.

Public Member Functions

 StochasticRandomVariable (int length=1)
 StochasticRandomVariable.
 StochasticRandomVariable (const RVArray &params, int length)
 StochasticRandomVariable (const RVArray &params, int length, int width)
virtual bool isNonRandom ()
 define RandomVariable functions
virtual bool isDiscrete ()
 most common default
virtual void setKnownValues ()

Detailed Description

There are two main types of random variables: (1) StochasticRandomVariables: represents an unconditional "stochastic" distribution. e.g., NormalRV, ExponentialRV, UniformRV, etc... but that also includes such building bloks as the EmpiricalRV (whose density is a weighted sum of diracs). Uncertainty even parents are given ==> Stochastic. (2) FunctionalRandomVariables: represents a RV that is a deterministic function of other RVs, e.g., the sum, mixture, product, exponential, etc... of parent RVs. A FunctionalRandomVariable, unlike a StochasticRandomVariable, can be nonRandom() if its parents are non-random (or if it has no parents).

A StochasticRandomVariable represents a "stochastic" distribution. Most "ordinary" distributions are of this type. Its parameters are its parents (which can be random or not). A StochasticRandomVariable can NEVER be random, even when its parents are non-random. Some sub-classes of StochasticRandomVariable can be defined which have no RandomVar parameters (i.e., no parents).

Definition at line 961 of file RandomVar.h.


Constructor & Destructor Documentation

PLearn::StochasticRandomVariable::StochasticRandomVariable ( int  length = 1)

StochasticRandomVariable.

Definition at line 945 of file RandomVar.cc.

    :RandomVariable(length) {}
PLearn::StochasticRandomVariable::StochasticRandomVariable ( const RVArray params,
int  length 
)

Definition at line 948 of file RandomVar.cc.

    :RandomVariable(parameters,length)
{}
PLearn::StochasticRandomVariable::StochasticRandomVariable ( const RVArray params,
int  length,
int  width 
)

Definition at line 953 of file RandomVar.cc.

    :RandomVariable(parameters,length,width)
{
}

Member Function Documentation

virtual bool PLearn::StochasticRandomVariable::isDiscrete ( ) [inline, virtual]

most common default

Implements PLearn::RandomVariable.

Reimplemented in PLearn::MixtureRandomVariable, and PLearn::MultinomialRandomVariable.

Definition at line 974 of file RandomVar.h.

{ return false; }
virtual bool PLearn::StochasticRandomVariable::isNonRandom ( ) [inline, virtual]

define RandomVariable functions

the only exception to this default would be a dirac distribution

Implements PLearn::RandomVariable.

Definition at line 971 of file RandomVar.h.

Referenced by setKnownValues().

{ return false; }

Here is the caller graph for this function:

void PLearn::StochasticRandomVariable::setKnownValues ( ) [virtual]

traverse the graph of ancestors of this node and mark nodes which are deterministic descendents of marked nodes while setting their "value" field as a function of their parents.

Reimplemented from PLearn::RandomVariable.

Reimplemented in PLearn::MixtureRandomVariable.

Definition at line 959 of file RandomVar.cc.

References isNonRandom(), PLearn::RandomVariable::marked, PLearn::RandomVariable::parents, PLearn::RandomVariable::pmark, PLearn::RandomVariable::setValueFromParentsValue(), and PLearn::TVec< T >::size().

{
    if (!marked && !pmark)
    {
        pmark=true;
        // a StochasticRandomVariable cannot be non-random
        // unless it is a "dirac" distribution (i.e., isNonRandom()==true).
        for (int i=0;i<parents.size();i++)
            parents[i]->setKnownValues();
        setValueFromParentsValue();
        if (isNonRandom()) marked=true;
    }
}

Here is the call graph for this function:


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