#include <RandomVar.h>
Inheritance diagram for PLearn::ProductRandomVariable:
Public Member Functions | |
ProductRandomVariable (MatRandomVar input1, MatRandomVar input2) | |
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) |
!< SUBCLASS WRITERS: IMPLEMENT FUNCTIONS BELOW //!< | |
void | EMBprop (const Vec obs, real post) |
void | EMTrainingInitialize (const RVArray ¶meters_to_learn) |
Initialization of EM training (before all the iterations start). | |
void | EMEpochInitialize () |
Initialization of an individual EMEpoch. | |
void | EMUpdate () |
const RandomVar & | X0 () |
viewed as mxn matrix | |
const RandomVar & | X1 () |
viewed as nx1 vector | |
bool | learn_X0 () |
stuff for EM | |
bool | learn_X1 () |
Public Attributes | |
int | m |
int | n |
int | l |
dimensions of the matrices Y(mxl) = X0(mxn) * X1(nxl) | |
bool | scalars |
= (m==1 && n==1 && l==1); | |
bool | learn_something |
Mat | X0numerator |
mxn matrix, used in the case X0 is learned | |
Mat | X1numerator |
nxl vector, used in the case X1 is learned | |
Mat | denom |
nxn matrix denominator | |
Mat | tmp1 |
temporary matrices to avoid allocating in loops | |
Mat | tmp2 |
Mat | tmp3 |
Vec | vtmp3 |
Vec version of tmp3. | |
Vec | tmp4 |
where Y is an mxl matrix (or a vector viewed as mx1 or 1xl), X0 is an mxn matrix, or a vector which must be 1xn or mx1, X1 is an nxl matrix, or a vector which must be nx1 or 1xl; this includes the special cases where one or the other is scalar (n=1 or l=1), or both are scalar (m=n=l=1).
if both X0 and X1 are observed, and one of them is learnable, then it can be learned by EM (p_t denotes posterior for example t, and y_t the output observation for example t):
Note that sometimes the nxn matrix to invert is a 1x1 scalar.
Definition at line 1417 of file RandomVar.h.
|
|
|
Implements PLearn::RandomVariable. Definition at line 1424 of file RandomVar.h. |
|
************ 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 1683 of file RandomVar.cc. References PLearn::TMat< T >::data(), PLearn::TVec< T >::data(), denom, l, learn_something, learn_X0(), m, PLearn::multiplyAcc(), PLERROR, PLearn::productTranspose(), scalars, PLearn::solveLinearSystem(), PLearn::solveTransposeLinearSystem(), tmp1, tmp2, tmp3, PLearn::TVec< T >::toMat(), PLearn::transposeProduct(), vtmp3, X0(), X0numerator, X1(), and X1numerator. |
|
Initialization of an individual EMEpoch. the default just propagates to the unmarked parents Reimplemented from PLearn::RandomVariable. Definition at line 1669 of file RandomVar.cc. References PLearn::TMat< T >::clear(), denom, learn_something, learn_X0(), X0numerator, and X1numerator. |
|
Initialization of EM training (before all the iterations start). the default just propagates to the unmarked parents Reimplemented from PLearn::RandomVariable. Definition at line 1633 of file RandomVar.cc. References denom, l, learn_something, learn_X0(), learn_X1(), m, n, PLERROR, PLearn::TVec< T >::resize(), PLearn::TMat< T >::resize(), tmp1, tmp2, tmp3, tmp4, PLearn::TMat< T >::toVec(), vtmp3, X0(), X0numerator, X1(), and X1numerator. |
|
update the fixed (non-random) parameters using internal learning mechanism, at end of an EMEpoch. the default just propagates to the unmarked parents. Reimplemented from PLearn::RandomVariable. Definition at line 1807 of file RandomVar.cc. References denom, learn_something, learn_X0(), scalars, PLearn::solveLinearSystemByCholesky(), PLearn::solveTransposeLinearSystemByCholesky(), tmp2, tmp4, X0(), X0numerator, X1(), and X1numerator. |
|
!< 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 1610 of file RandomVar.cc. References PLearn::abs(), PLearn::det(), PLearn::leftPseudoInverse(), PLearn::log(), PLearn::product(), PLearn::rightPseudoInverse(), PLearn::TVec< RVInstance >::size(), X0(), and X1(). |
|
stuff for EM
Definition at line 1440 of file RandomVar.h. Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate(). |
|
Definition at line 1441 of file RandomVar.h. Referenced by EMTrainingInitialize(). |
|
set the field value from the values of the parents
Implements PLearn::FunctionalRandomVariable. Definition at line 1603 of file RandomVar.cc. |
|
viewed as mxn matrix
Definition at line 1435 of file RandomVar.h. Referenced by EMBprop(), EMTrainingInitialize(), EMUpdate(), invertible(), and setValueFromParentsValue(). |
|
viewed as nx1 vector
Definition at line 1436 of file RandomVar.h. Referenced by EMBprop(), EMTrainingInitialize(), EMUpdate(), invertible(), and setValueFromParentsValue(). |
|
nxn matrix denominator
Definition at line 1445 of file RandomVar.h. Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate(). |
|
dimensions of the matrices Y(mxl) = X0(mxn) * X1(nxl)
Definition at line 1420 of file RandomVar.h. Referenced by EMBprop(), and EMTrainingInitialize(). |
|
Definition at line 1442 of file RandomVar.h. Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate(). |
|
Definition at line 1420 of file RandomVar.h. Referenced by EMBprop(), and EMTrainingInitialize(). |
|
Definition at line 1420 of file RandomVar.h. Referenced by EMTrainingInitialize(). |
|
= (m==1 && n==1 && l==1);
Definition at line 1437 of file RandomVar.h. Referenced by EMBprop(), and EMUpdate(). |
|
temporary matrices to avoid allocating in loops
Definition at line 1446 of file RandomVar.h. Referenced by EMBprop(), and EMTrainingInitialize(). |
|
Definition at line 1447 of file RandomVar.h. Referenced by EMBprop(), EMTrainingInitialize(), and EMUpdate(). |
|
Definition at line 1448 of file RandomVar.h. Referenced by EMBprop(), and EMTrainingInitialize(). |
|
Definition at line 1450 of file RandomVar.h. Referenced by EMTrainingInitialize(), and EMUpdate(). |
|
Vec version of tmp3.
Definition at line 1449 of file RandomVar.h. Referenced by EMBprop(), and EMTrainingInitialize(). |
|
mxn matrix, used in the case X0 is learned
Definition at line 1443 of file RandomVar.h. Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate(). |
|
nxl vector, used in the case X1 is learned
Definition at line 1444 of file RandomVar.h. Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate(). |