W3cubDocs

/TensorFlow Python

tf.contrib.distributions.assign_moving_mean_variance

tf.contrib.distributions.assign_moving_mean_variance(
    mean_var,
    variance_var,
    value,
    decay,
    name=None
)

Defined in tensorflow/contrib/distributions/python/ops/moving_stats.py.

Compute exponentially weighted moving {mean,variance} of a streaming value.

The value updated exponentially weighted moving mean_var and variance_var are given by the following recurrence relations:

variance_var = decay * (variance_var + (1-decay) * (value - mean_var)**2)
mean_var     = decay * mean_var + (1 - decay) * value
Note: mean_var is updated after variance_var, i.e., variance_var uses the lag-1 mean.

For derivation justification, see [Finch (2009; Eq. 143)][1].

Args:

  • mean_var: float-like Variable representing the exponentially weighted moving mean. Same shape as variance_var and value.
  • variance_var: float-like Variable representing the exponentially weighted moving variance. Same shape as mean_var and value.
  • value: float-like Tensor. Same shape as mean_var and variance_var.
  • decay: A float-like Tensor. The moving mean decay. Typically close to 1., e.g., 0.999.
  • name: Optional name of the returned operation.

Returns:

  • mean_var: Variable representing the value-updated exponentially weighted moving mean.
  • variance_var: Variable representing the value-updated exponentially weighted moving variance.

Raises:

  • TypeError: if mean_var does not have float type dtype.
  • TypeError: if mean_var, variance_var, value, decay have different base_dtype.

References

[1]: Tony Finch. Incremental calculation of weighted mean and variance. Technical Report, 2009. http://people.ds.cam.ac.uk/fanf2/hermes/doc/antiforgery/stats.pdf

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/distributions/assign_moving_mean_variance