PLearn 0.1
Public Member Functions | Protected Attributes
PLearn::SubVecRandomVariable Class Reference

Y = sub-vector of X starting at position "start", of length "value->length()". More...

#include <RandomVar.h>

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

List of all members.

Public Member Functions

 SubVecRandomVariable (const RandomVar &parent, int start, int length)
 SubVecRandomVariable.
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 posterior)

Protected Attributes

int start

Detailed Description

Y = sub-vector of X starting at position "start", of length "value->length()".

Definition at line 1454 of file RandomVar.h.


Constructor & Destructor Documentation

PLearn::SubVecRandomVariable::SubVecRandomVariable ( const RandomVar parent,
int  start,
int  length 
)

SubVecRandomVariable.

Definition at line 2301 of file RandomVar.cc.

References PLERROR.

    :FunctionalRandomVariable(v, the_len), start(the_start)
{
    if (v->length() < the_len)
        PLERROR("new SubVecRandomVariable: input should have length at least %d, has %d",
                the_len, v->length());
}

Member Function Documentation

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

Implements PLearn::RandomVariable.

Definition at line 1460 of file RandomVar.h.

{ return "SubvecRandomVariable"; }
void PLearn::SubVecRandomVariable::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 2326 of file RandomVar.cc.

References PLearn::RandomVariable::length(), PLearn::RandomVariable::parents, and PLERROR.

{
    if (length()!=parents[0]->length())
        PLERROR("SubVecRandomVariable: can't EMBprop unless length==parent.length()");
    // the only "invertible" case is when this RandomVar is a copy of its parent
    parents[0]->EMBprop(obs,posterior);
}

Here is the call graph for this function:

bool PLearn::SubVecRandomVariable::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 2316 of file RandomVar.cc.

References PLearn::RandomVariable::length(), and PLearn::RandomVariable::parents.

{
    if (length()!=parents[0]->length())
        return false;
    // the only invertible case is when this RandomVar is a copy of its parent
    unobserved_parents[0].v = obs;
    return true;
}

Here is the call graph for this function:

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

set the field value from the values of the parents

Implements PLearn::FunctionalRandomVariable.

Definition at line 2309 of file RandomVar.cc.

References PLearn::Var::length(), PLearn::RandomVariable::marked, PLearn::RandomVariable::parents, start, PLearn::TVec< T >::subVec(), and PLearn::RandomVariable::value.

{
    if (marked) return;
    value = parents[0]->value->subVec(start,value->length());
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 1457 of file RandomVar.h.

Referenced by setValueFromParentsValue().


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