Tensorflow.js tf.movingAverage() Function
Introduction: Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment.
The .movingAverage() function is used to determine the moving average of a variable.
- In absence of zeroDebias, the moving average operation is specified by: v += delta. Where, delta = (1 – decay) * (x – v).
- In presence of zeroDebias (default), the delta term is measured in order to debias the effect of the (presumed) zero-initialization of v. Where delta /= (1 – decay ^ step).
- This function is entirely stateless and do not keeps path of step count. Moreover, the stated step count demands to be saved by the caller as well as passed in as step.
tf.movingAverage(v, x, decay, step?, zeroDebias?)
- v: The stated current moving average value. It can be of type tf.Tensor, TypedArray, or Array.
- x: The stated new input value, which should have the identical shape as well as datatype like v.
- decay: The stated decay factor. Whose values are 0.95 and 0.99 typically. It can be of type number, or tf.Scalar.
- step: The stated step count. It is optional and is of type number, or tf.Scalar.
- zeroDebias: It checks if zeroDebias is to be executed. The by default value is true. It is optional and is of type boolean.
Return Value: It returns tf.Tensor.
Tensor [1, 5.2857141, 3.2857144, 1]
Tensor [1.1010001, 3.1429999, 5.4710002, 1.298]