bayespy.inference.vmp.nodes.node.Moments¶
- class bayespy.inference.vmp.nodes.node.Moments[source]¶
Base class for defining the expectation of the sufficient statistics.
The benefits:
Write statistic-specific features in one place only. For instance, covariance from Gaussian message.
Different nodes may have identically defined statistic so you need to implement related features only once. For instance, Gaussian and GaussianARD differ on the prior but the moments are the same.
General processing nodes which do not change the type of the moments may “inherit” the features from the parent node. For instance, slicing operator.
Conversions can be done easily in both of the above cases if the message conversion is defined in the moments class. For instance, GaussianMarkovChain to Gaussian and VaryingGaussianMarkovChain to Gaussian.
- __init__()¶
Methods
__init__
()add_converter
(moments_to, converter)from_values
(x)get_converter
(moments_to)Finds conversion to another moments type if possible.
Override this method when moment class instances are not identical if they have different attributes.
get_instance_converter
(**kwargs)Default converter within a moments class is an identity.