#include <RandomVar.h>
Inheritance diagram for PLearn::MixtureRandomVariable:
Public Member Functions | |
MixtureRandomVariable (const RVArray &components, const RandomVar &log_weights) | |
MixtureRandomVariable *. | |
virtual char * | classname () |
const RandomVar & | log_weights () |
convenience inline: actual weights = softmax(log_weights) | |
bool & | learn_the_weights () |
virtual Var | logP (const Var &obs, const RVInstanceArray &RHS, RVInstanceArray *parameters_to_learn) |
virtual Var | ElogP (const Var &obs, RVInstanceArray ¶meters_to_learn, const RVInstanceArray &RHS) |
virtual void | setValueFromParentsValue () |
virtual void | EMUpdate () |
virtual void | EMBprop (const Vec obs, real posterior) |
virtual void | EMEpochInitialize () |
Initialization of an individual EMEpoch. | |
virtual void | EMTrainingInitialize (const RVArray ¶meters_to_learn) |
Initialization of EM training (before all the iterations start). | |
virtual bool | isDiscrete () |
most common default | |
virtual bool | canStopEM () |
virtual void | setKnownValues () |
virtual void | unmarkAncestors () |
clear not only the marked field but also that of parents | |
virtual void | clearEMmarks () |
Protected Attributes | |
RVArray | components |
component distributions. | |
Vec | posteriors |
P(i-th component | obs), used in EM. | |
Vec | sum_posteriors |
sum of posteriors over trianing data | |
VarArray | componentsLogP |
result of logP call for each component | |
Var | lw |
= log(softmax(log_weights()->value())) | |
Var | logp |
result of last call to logP |
|
Definition at line 2018 of file RandomVar.cc. |
|
Has the distribution seen enough EM iterations to meaningfully stop EM iterative training? This is a way for a RandomVariable sub-class to force continuation of the EM iterations beyond the criteria given by the caller of EM. the default just propagates to the unmarked parents. Reimplemented from PLearn::RandomVariable. Definition at line 2183 of file RandomVar.cc. References components, log_weights(), and PLearn::TVec< RandomVar >::size(). |
|
Implements PLearn::RandomVariable. Definition at line 1253 of file RandomVar.h. |
|
Reimplemented from PLearn::RandomVariable. Definition at line 2221 of file RandomVar.cc. References components, log_weights(), and PLearn::TVec< RandomVar >::size(). |
|
Definition at line 2057 of file RandomVar.cc. References components, componentsLogP, PLearn::exp(), PLearn::TVec< T >::length(), PLearn::log(), log_weights(), PLearn::logadd(), PLearn::logP(), logp, lw, PLearn::marginalize(), posteriors, PLearn::softmax(), PLearn::Var::subVec(), PLearn::sum(), PLearn::RVInstanceArray::swap_v_and_Vvalue(), unmarkAncestors(), and PLearn::vconcat(). |
|
************ 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 2133 of file RandomVar.cc. References PLearn::apply(), components, componentsLogP, PLearn::TVec< T >::data(), PLearn::endl(), PLearn::exp(), learn_the_weights(), PLearn::Var::length(), logp, lw, posteriors, PLearn::safeexp(), PLearn::sum(), sum_posteriors, and PLearn::tRealFunc. |
|
Initialization of an individual EMEpoch. the default just propagates to the unmarked parents Reimplemented from PLearn::RandomVariable. Definition at line 2123 of file RandomVar.cc. References PLearn::TVec< T >::clear(), components, learn_the_weights(), PLearn::TVec< RandomVar >::size(), and sum_posteriors. |
|
Initialization of EM training (before all the iterations start). the default just propagates to the unmarked parents Reimplemented from PLearn::RandomVariable. Definition at line 2113 of file RandomVar.cc. References components, PLearn::TVec< RandomVar >::contains(), learn_the_weights(), log_weights(), and PLearn::TVec< RandomVar >::size(). |
|
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 2164 of file RandomVar.cc. References PLearn::apply(), components, learn_the_weights(), log_weights(), PLearn::multiply(), posteriors, PLearn::safeflog(), PLearn::TVec< RandomVar >::size(), PLearn::sum(), and sum_posteriors. |
|
most common default
Reimplemented from PLearn::StochasticRandomVariable. Definition at line 2192 of file RandomVar.cc. References components. |
|
Definition at line 1258 of file RandomVar.h. Referenced by EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), and EMUpdate(). |
|
convenience inline: actual weights = softmax(log_weights)
Definition at line 1257 of file RandomVar.h. Referenced by canStopEM(), clearEMmarks(), ElogP(), EMTrainingInitialize(), EMUpdate(), logP(), setKnownValues(), setValueFromParentsValue(), and unmarkAncestors(). |
|
Construct a Var that computes logP(This = obs | RHS ). This function SHOULD NOT be used directly, but is called by the global function logP (same argument), which does proper massaging of the network before and after this call. Implements PLearn::RandomVariable. Definition at line 2027 of file RandomVar.cc. References components, componentsLogP, PLearn::ElogP(), PLearn::TVec< T >::length(), PLearn::log(), log_weights(), PLearn::logadd(), PLearn::logP(), logp, lw, PLearn::marginalize(), posteriors, PLearn::softmax(), PLearn::Var::subVec(), and PLearn::vconcat(). |
|
traverse the graph of ancestors of this node and mark nodes which are deterministic descendents of marked nodes while setting their "value" field as a function of their parents. Reimplemented from PLearn::StochasticRandomVariable. Definition at line 2197 of file RandomVar.cc. References components, log_weights(), setValueFromParentsValue(), and PLearn::TVec< RandomVar >::size(). |
|
define the formula that gives a value to this RV given its parent's value (sets the value field). If the RV is stochastic, the formula may also be "stochastic" (using SampleVariable's to define the Var). Implements PLearn::RandomVariable. Definition at line 2106 of file RandomVar.cc. References components, log_weights(), PLearn::softmax(), and PLearn::RVArray::values(). Referenced by setKnownValues(). |
|
clear not only the marked field but also that of parents
Reimplemented from PLearn::RandomVariable. Definition at line 2209 of file RandomVar.cc. References components, log_weights(), and PLearn::TVec< RandomVar >::size(). Referenced by ElogP(). |
|
component distributions.
Definition at line 1247 of file RandomVar.h. Referenced by canStopEM(), clearEMmarks(), ElogP(), EMBprop(), EMEpochInitialize(), EMTrainingInitialize(), EMUpdate(), isDiscrete(), logP(), setKnownValues(), setValueFromParentsValue(), and unmarkAncestors(). |
|
result of logP call for each component
Definition at line 1282 of file RandomVar.h. |
|
result of last call to logP
Definition at line 1284 of file RandomVar.h. |
|
= log(softmax(log_weights()->value()))
Definition at line 1283 of file RandomVar.h. |
|
P(i-th component | obs), used in EM.
Definition at line 1278 of file RandomVar.h. Referenced by ElogP(), EMBprop(), EMUpdate(), and logP(). |
|
sum of posteriors over trianing data
Definition at line 1279 of file RandomVar.h. Referenced by EMBprop(), EMEpochInitialize(), and EMUpdate(). |