Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::ProductRandomVariable Class Reference

#include <RandomVar.h>

Inheritance diagram for PLearn::ProductRandomVariable:

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

Collaboration graph
[legend]
List of all members.

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 &parameters_to_learn)
 Initialization of EM training (before all the iterations start).

void EMEpochInitialize ()
 Initialization of an individual EMEpoch.

void EMUpdate ()
const RandomVarX0 ()
 viewed as mxn matrix

const RandomVarX1 ()
 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

Detailed Description

Y = X0 * X1

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.


Constructor & Destructor Documentation

PLearn::ProductRandomVariable::ProductRandomVariable MatRandomVar  input1,
MatRandomVar  input2
 


Member Function Documentation

virtual char* PLearn::ProductRandomVariable::classname  )  [inline, virtual]
 

Implements PLearn::RandomVariable.

Definition at line 1424 of file RandomVar.h.

void PLearn::ProductRandomVariable::EMBprop const Vec  obs,
real  post
[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 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.

void PLearn::ProductRandomVariable::EMEpochInitialize  )  [virtual]
 

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.

void PLearn::ProductRandomVariable::EMTrainingInitialize const RVArray parameters_to_learn  )  [virtual]
 

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.

void PLearn::ProductRandomVariable::EMUpdate  )  [virtual]
 

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.

bool PLearn::ProductRandomVariable::invertible const Var obs,
RVInstanceArray unobserved_parents,
Var **  JacobianCorrection
[virtual]
 

!< 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().

bool PLearn::ProductRandomVariable::learn_X0  )  [inline]
 

stuff for EM

Definition at line 1440 of file RandomVar.h.

Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate().

bool PLearn::ProductRandomVariable::learn_X1  )  [inline]
 

Definition at line 1441 of file RandomVar.h.

Referenced by EMTrainingInitialize().

void PLearn::ProductRandomVariable::setValueFromParentsValue  )  [virtual]
 

set the field value from the values of the parents

Implements PLearn::FunctionalRandomVariable.

Definition at line 1603 of file RandomVar.cc.

References X0(), and X1().

const RandomVar& PLearn::ProductRandomVariable::X0  )  [inline]
 

viewed as mxn matrix

Definition at line 1435 of file RandomVar.h.

Referenced by EMBprop(), EMTrainingInitialize(), EMUpdate(), invertible(), and setValueFromParentsValue().

const RandomVar& PLearn::ProductRandomVariable::X1  )  [inline]
 

viewed as nx1 vector

Definition at line 1436 of file RandomVar.h.

Referenced by EMBprop(), EMTrainingInitialize(), EMUpdate(), invertible(), and setValueFromParentsValue().


Member Data Documentation

Mat PLearn::ProductRandomVariable::denom
 

nxn matrix denominator

Definition at line 1445 of file RandomVar.h.

Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate().

int PLearn::ProductRandomVariable::l
 

dimensions of the matrices Y(mxl) = X0(mxn) * X1(nxl)

Definition at line 1420 of file RandomVar.h.

Referenced by EMBprop(), and EMTrainingInitialize().

bool PLearn::ProductRandomVariable::learn_something
 

Definition at line 1442 of file RandomVar.h.

Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate().

int PLearn::ProductRandomVariable::m
 

Definition at line 1420 of file RandomVar.h.

Referenced by EMBprop(), and EMTrainingInitialize().

int PLearn::ProductRandomVariable::n
 

Definition at line 1420 of file RandomVar.h.

Referenced by EMTrainingInitialize().

bool PLearn::ProductRandomVariable::scalars
 

= (m==1 && n==1 && l==1);

Definition at line 1437 of file RandomVar.h.

Referenced by EMBprop(), and EMUpdate().

Mat PLearn::ProductRandomVariable::tmp1
 

temporary matrices to avoid allocating in loops

Definition at line 1446 of file RandomVar.h.

Referenced by EMBprop(), and EMTrainingInitialize().

Mat PLearn::ProductRandomVariable::tmp2
 

Definition at line 1447 of file RandomVar.h.

Referenced by EMBprop(), EMTrainingInitialize(), and EMUpdate().

Mat PLearn::ProductRandomVariable::tmp3
 

Definition at line 1448 of file RandomVar.h.

Referenced by EMBprop(), and EMTrainingInitialize().

Vec PLearn::ProductRandomVariable::tmp4
 

Definition at line 1450 of file RandomVar.h.

Referenced by EMTrainingInitialize(), and EMUpdate().

Vec PLearn::ProductRandomVariable::vtmp3
 

Vec version of tmp3.

Definition at line 1449 of file RandomVar.h.

Referenced by EMBprop(), and EMTrainingInitialize().

Mat PLearn::ProductRandomVariable::X0numerator
 

mxn matrix, used in the case X0 is learned

Definition at line 1443 of file RandomVar.h.

Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate().

Mat PLearn::ProductRandomVariable::X1numerator
 

nxl vector, used in the case X1 is learned

Definition at line 1444 of file RandomVar.h.

Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:24:27 2004 for PLearn by doxygen 1.3.7