pub fn binarize<S>(
array: &ArrayBase<S, Ix2>,
threshold: f64,
) -> Result<Array2<f64>>
Expand description
Binarizes data (sets feature values to 0 or 1) according to a threshold
§Arguments
array
- The input array to binarizethreshold
- The threshold used to binarize. Values above the threshold map to 1, others to 0.
§Returns
Result<Array2<f64>>
- The binarized array
§Examples
use scirs2_core::ndarray::array;
use scirs2_transform::features::binarize;
let data = array![[1.0, -1.0, 2.0],
[2.0, 0.0, 0.0],
[-1.0, 1.0, -1.0]];
let binarized = binarize(&data, 0.0).unwrap();