tf.contrib.distributions.moving_mean_variance(
value,
decay,
collections=None,
name=None
)
Defined in tensorflow/contrib/distributions/python/ops/moving_stats.py
.
Compute exponentially weighted moving {mean,variance} of a streaming value.
The exponentially-weighting moving mean_var
and variance_var
are updated
by value
according to the following recurrence:
variance_var = decay * (variance_var + (1-decay) * (value - mean_var)**2)
mean_var = decay * mean_var + (1 - decay) * value
For derivation justification, see [Finch (2009; Eq. 143)][1].
Unlike assign_moving_mean_variance
, this function handles
variable creation.
Args:
value
:float
-likeTensor
. Same shape asmean_var
andvariance_var
.decay
: Afloat
-likeTensor
. The moving mean decay. Typically close to1.
, e.g.,0.999
.collections
: Python list of graph-collections keys to which the internal variablesmean_var
andvariance_var
are added. Default value is[GraphKeys.GLOBAL_VARIABLES]
.name
: Optional name of the returned operation.
Returns:
mean_var
:Variable
representing thevalue
-updated exponentially weighted moving mean.variance_var
:Variable
representing thevalue
-updated exponentially weighted moving variance.
Raises:
TypeError
: ifvalue_var
does not have float typedtype
.TypeError
: ifvalue
,decay
have differentbase_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