sklearn.preprocessing.binarize(X, threshold=0.0, copy=True)
[source]
Boolean thresholding of array-like or scipy.sparse matrix
Read more in the User Guide.
Parameters: |
X : {array-like, sparse matrix}, shape [n_samples, n_features] The data to binarize, element by element. scipy.sparse matrices should be in CSR or CSC format to avoid an un-necessary copy. threshold : float, optional (0.0 by default) Feature values below or equal to this are replaced by 0, above it by 1. Threshold may not be less than 0 for operations on sparse matrices. copy : boolean, optional, default 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 / CSC matrix and if axis is 1). |
---|
See also
Binarizer
Transformer
API (e.g. as part of a preprocessing sklearn.pipeline.Pipeline
).
© 2007–2017 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.binarize.html