Function smartnoise_runtime::components::impute::impute_float_gaussian_arrayd [−][src]
pub fn impute_float_gaussian_arrayd(
data: ArrayD<Float>,
lower: ArrayD<Float>,
upper: ArrayD<Float>,
shift: ArrayD<Float>,
scale: ArrayD<Float>,
enforce_constant_time: bool
) -> Result<ArrayD<Float>>
Returns data with imputed values in place of f64::NAN
.
Values are imputed from a truncated Gaussian distribution.
Arguments
data
- Data for which you would like to impute theNAN
values.shift
- The mean of the untruncated Gaussian noise distribution for each column.scale
- The standard deviation of the untruncated Gaussian noise distribution for each column.lower
- Lower bound on imputation range for each column.upper
- Upper bound on imputation range for each column.
Return
Data with NAN
values replaced with imputed values.
Example
use ndarray::prelude::*; use smartnoise_runtime::components::impute::impute_float_gaussian_arrayd; use smartnoise_validator::Float; let data: ArrayD<Float> = arr1(&[1., Float::NAN, 3., Float::NAN]).into_dyn(); let lower: ArrayD<Float> = arr1(&[0.0]).into_dyn(); let upper: ArrayD<Float> = arr1(&[10.0]).into_dyn(); let shift: ArrayD<Float> = arr1(&[5.0]).into_dyn(); let scale: ArrayD<Float> = arr1(&[7.0]).into_dyn(); let imputed = impute_float_gaussian_arrayd(data, lower, upper, shift, scale, false);