Compute Variance Manually

0
easy

Given a one-dimensional tensor `data` representing a set of samples, manually compute the biased variance (population variance) without using built-in functions specifically designed for variance computation. Return the biased variance of the data.

σbiased2=1Ni=1N(xiμ)2\sigma^2_{biased} = \frac{1}{N} \sum_{i=1}^{N} (x_i - \mu)^2
Where:
  • xix_i: Each individual data point.
  • μ\mu: Mean of the data.
  • σbiased2\sigma^2_{biased}: Biased variance (population variance) of the data.
  • NN: Number of data points.

Examples:

1.0
2
3
4
5
2
3.0
3
3
3
3
0

Loading...
2024 © TensorGym
Contrinbute | Contact | Copyright | 𝕏