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__($self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.


add_converter(moments_to, converter)
get_converter(moments_to) Finds conversion to another moments type if possible.
get_instance_conversion_kwargs() 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.