PLearn 0.1
Public Member Functions
PLearn::RandomElementOfRandomVariable Class Reference

RandomVariable that is the element of the first parent RandomVariable indexed by the second parent RandomVariable. More...

#include <RandomVar.h>

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

List of all members.

Public Member Functions

 RandomElementOfRandomVariable (const RandomVar &v, const RandomVar &index)
 RandomElementOfRandomVariable.
virtual char * classname ()
void setValueFromParentsValue ()
 set the field value from the values of the parents
bool invertible (const Var &obs, RVInstanceArray &unobserved_parents, Var **JacobianCorrection)
 functions specific to FunctionalRandomVariable's
void EMBprop (const Vec obs, real post)
const RandomVarv ()
 convenience inlines
const RandomVarindex ()

Detailed Description

RandomVariable that is the element of the first parent RandomVariable indexed by the second parent RandomVariable.

Definition at line 1124 of file RandomVar.h.


Constructor & Destructor Documentation

PLearn::RandomElementOfRandomVariable::RandomElementOfRandomVariable ( const RandomVar v,
const RandomVar index 
)

RandomElementOfRandomVariable.

Definition at line 1144 of file RandomVar.cc.

References PLERROR.

    :FunctionalRandomVariable(v&index,1)
{ 
    if (index->length()!=1)
        PLERROR("RandomElementOfRandomVariables expects an index RandomVar of length 1");
}

Member Function Documentation

virtual char* PLearn::RandomElementOfRandomVariable::classname ( ) [inline, virtual]

Implements PLearn::RandomVariable.

Definition at line 1129 of file RandomVar.h.

{ return "RandomElementOfRandomVariable"; }
void PLearn::RandomElementOfRandomVariable::EMBprop ( const Vec  obs,
real  posterior 
) [virtual]

************ EM STUFF ********** propagate posterior information to parents in order to perform an EMupdate at the end of an EMEpoch. In the case of mixture-like RVs and their components, the posterior is the probability of the component "this" given the observation "obs".

Implements PLearn::RandomVariable.

Definition at line 1170 of file RandomVar.cc.

{
}
const RandomVar& PLearn::RandomElementOfRandomVariable::index ( ) [inline]

Definition at line 1138 of file RandomVar.h.

Referenced by setValueFromParentsValue().

{ return parents[1]; }

Here is the caller graph for this function:

bool PLearn::RandomElementOfRandomVariable::invertible ( const Var obs,
RVInstanceArray unobserved_parents,
Var **  JacobianCorrection 
) [virtual]

functions specific to FunctionalRandomVariable's

!< SUBCLASS WRITERS: IMPLEMENT FUNCTIONS BELOW //!<

check whether it is possible to invert the function which maps the given unobserved parents to the observed value of the RV (obs). If invertible, do the inversion, and set the value fields of the RVInstances to Var's which are functionally dependent on obs. If the absolute value of the Jacobian of the map from the unobserved parents to this R.V.'s value is different from 1, then JacobianCorrection should point to a Var that is the logarithm of the determinant of this Jacobian (first derivatives) matrix. If the function is not invertible but it is possible to write P(Y==obs | unobserved_parents) in terms of the unobserved_parents logP functions, then the sub-class writer should instead redefine the logP function appropriately.

Reimplemented from PLearn::FunctionalRandomVariable.

Definition at line 1159 of file RandomVar.cc.

References PLERROR, PLearn::TVec< T >::size(), and v().

{
    // IT IS POSSIBLE TO COMPUTE A LOGP WITHOUT INTEGRATING
    // IF v() IS OBSERVED
    if (v()==unobserved_parents[0].V && unobserved_parents.size()==1)
        PLERROR("RandomElementOFRandomVariable could compute logP but not implemented");
    return false;
}

Here is the call graph for this function:

void PLearn::RandomElementOfRandomVariable::setValueFromParentsValue ( ) [virtual]

set the field value from the values of the parents

Implements PLearn::FunctionalRandomVariable.

Definition at line 1152 of file RandomVar.cc.

References index(), PLearn::RandomVariable::marked, v(), and PLearn::RandomVariable::value.

{
    if (marked) return;
    value = v()->value[index()->value];
}

Here is the call graph for this function:

const RandomVar& PLearn::RandomElementOfRandomVariable::v ( ) [inline]

convenience inlines

Definition at line 1137 of file RandomVar.h.

Referenced by invertible(), and setValueFromParentsValue().

{ return parents[0]; }

Here is the caller 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