Function smartnoise_runtime::components::raw_moment::raw_moment [−][src]
pub fn raw_moment(data: &ArrayD<Float>, order: u32) -> Result<ArrayD<Float>>
Accepts data and returns sample estimate of kth raw moment for each column.
Arguments
data
- Data for which you would like the kth raw moments.order
- Number representing the kth moment you want.
Return
kth sample moment for each column.
Example
use ndarray::{ArrayD, arr2, arr1}; use smartnoise_runtime::components::raw_moment::raw_moment; use smartnoise_validator::Float; let data: ArrayD<Float> = arr2(&[ [1., 1., 1.], [2., 4., 6.] ]).into_dyn(); let second_moments = raw_moment(&data, 2).unwrap(); assert_eq!(second_moments, arr2(&[[2.5, 8.5, 18.5]]).into_dyn());