PLearn 0.1
|
#include <RandomVar.h>
Public Member Functions | |
ExtendedRandomVariable (const RandomVar &parent, real fill_value=1.0, int n_extend=1) | |
ExtendedRandomVariable. | |
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 | n_extend |
real | fill_value |
If the RV is a vector (i.e., a column vector), extend it with n_extend fill_value; if it is a matrix (MatRandomVar), then extend the matrix with n_extend rows with value "fill_value". The "default" extension is with n_extend=1 and fill_value=1 (useful for extending a vector before an "affine" dot product).
Definition at line 1505 of file RandomVar.h.
PLearn::ExtendedRandomVariable::ExtendedRandomVariable | ( | const RandomVar & | parent, |
real | fill_value = 1.0 , |
||
int | n_extend = 1 |
||
) |
Definition at line 2337 of file RandomVar.cc.
:FunctionalRandomVariable(v, v->length()+nextend), n_extend(nextend), fill_value(fillvalue) { }
virtual char* PLearn::ExtendedRandomVariable::classname | ( | ) | [inline, virtual] |
Implements PLearn::RandomVariable.
Definition at line 1512 of file RandomVar.h.
{ return "ExtendedRandomVariable"; }
************ 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 2358 of file RandomVar.cc.
References PLearn::RVArray::length(), n, n_extend, PLearn::RandomVariable::parents, and PLearn::TVec< T >::subVec().
{ int n = n_extend*parents[0]->width(); parents[0]->EMBprop(obs.subVec(parents[0]->value->length(),n),posterior); }
bool PLearn::ExtendedRandomVariable::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 2350 of file RandomVar.cc.
References PLearn::Var::length(), n, n_extend, PLearn::RandomVariable::parents, PLearn::Var::subVec(), and PLearn::RandomVariable::value.
{ int n = n_extend*parents[0]->width(); unobserved_parents[0].v = obs->subVec(parents[0]->value->length(),n); return true; }
void PLearn::ExtendedRandomVariable::setValueFromParentsValue | ( | ) | [virtual] |
set the field value from the values of the parents
Implements PLearn::FunctionalRandomVariable.
Definition at line 2343 of file RandomVar.cc.
References PLearn::extend(), fill_value, PLearn::RandomVariable::marked, n_extend, PLearn::RandomVariable::parents, and PLearn::RandomVariable::value.
real PLearn::ExtendedRandomVariable::fill_value [protected] |
Definition at line 1509 of file RandomVar.h.
Referenced by setValueFromParentsValue().
int PLearn::ExtendedRandomVariable::n_extend [protected] |
Definition at line 1508 of file RandomVar.h.
Referenced by EMBprop(), invertible(), and setValueFromParentsValue().