Variance is defined as, Var = E[(X - E[X])**2] where X is the random variable associated with this distribution, E denotes expectation, and Var$shape = batch_shape + event_shape.

tfd_variance(distribution, ...)

Arguments

distribution

The distribution being used.

...

Additional parameters passed to Python.

Value

a Tensor of shape sample_shape(x) + self$batch_shape with values of type self$dtype.

See also

Examples

# \donttest{ d <- tfd_normal(loc = c(1, 2), scale = c(1, 0.5)) d %>% tfd_variance()
#> tf.Tensor([1. 0.25], shape=(2,), dtype=float32)
# }