Function smartnoise_runtime::components::variance::variance [−][src]
pub fn variance(
data: &ArrayD<Float>,
delta_degrees_of_freedom: usize
) -> Result<ArrayD<Float>>
Calculate estimate of variance for each column in data.
Arguments
data
- Data for which you would like the variance for each column.delta_degrees_of_freedom
- 0 for population, 1 for finite sample correction
Return
Variance for each column in the data.
Example
use ndarray::prelude::*; use smartnoise_runtime::components::variance::variance; let data = arr2(&[ [1.,10.], [2., 20.], [3., 30.] ]).into_dyn(); let variances = variance(&data, 1).unwrap(); assert_eq!(variances, arr2(&[[1., 100.]]).into_dyn());