8.23.8. sklearn.preprocessing.binarize¶
- sklearn.preprocessing.binarize(X, threshold=0.0, copy=True)¶
Boolean thresholding of array-like or scipy.sparse matrix
Parameters : X : array or scipy.sparse matrix with shape [n_samples, n_features]
The data to binarize, element by element. scipy.sparse matrices should be in CSR format to avoid an un-necessary copy.
threshold : float, optional (0.0 by default)
The lower bound that triggers feature values to be replaced by 1.0.
copy : boolean, optional, default is True
set to False to perform inplace binarization and avoid a copy (if the input is already a numpy array or a scipy.sparse CSR matrix and if axis is 1).
See also
sklearn.preprocessing.Binarizer, using, sklearn.pipeline.Pipeline