sakura.utils.data_transformations.ToBinary
- class sakura.utils.data_transformations.ToBinary
Bases:
objectConvert input data into binary form (0 or 1) using sklearn Binarizer
To handle floating point error, a threshold (epsilon) is applied to check if the value should be classified as 0 or 1.
- Parameters:
sample (array-like or sparse matrix) – Input data of shape (n_samples, n_features) to binarize
threshold (float, optional) – Values > threshold become 1, others 0, defaults to 1e-6
inverse (bool, optional) – Whether to invert binary values (1 → 0, 0 → 1), defaults to False
scale_factor (float, optional) – Multiply final output by this value, defaults to 1.0
- Returns:
Transformed binarized output data
- Return type:
numpy.ndarray or scipy.sparse matrix
Methods