A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://scikit-learn.org/stable/modules/generated/../generated/sklearn.preprocessing.binarize.html below:

binarize — scikit-learn 1.7.0 documentation

binarize#
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} of 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.

thresholdfloat, default=0.0

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.

copybool, default=True

If False, try to avoid a copy and binarize in place. This is not guaranteed to always work in place; e.g. if the data is a numpy array with an object dtype, a copy will be returned even with copy=False.

Returns:
X_tr{ndarray, sparse matrix} of shape (n_samples, n_features)

The transformed data.

See also

Binarizer

Performs binarization using the Transformer API (e.g. as part of a preprocessing Pipeline).

Examples

>>> from sklearn.preprocessing import binarize
>>> X = [[0.4, 0.6, 0.5], [0.6, 0.1, 0.2]]
>>> binarize(X, threshold=0.5)
array([[0., 1., 0.],
       [1., 0., 0.]])

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4