A RetroSearch Logo

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

Search Query:

Showing content from https://scikit-learn.org/dev/auto_examples/../api/../modules/generated/sklearn.utils.safe_mask.html below:

safe_mask — scikit-learn 1.8.dev0 documentation

safe_mask#
sklearn.utils.safe_mask(X, mask)[source]#

Return a mask which is safe to use on X.

Parameters:
X{array-like, sparse matrix}

Data on which to apply mask.

maskarray-like

Mask to be used on X.

Returns:
maskndarray

Array that is safe to use on X.

Examples

>>> from sklearn.utils import safe_mask
>>> from scipy.sparse import csr_matrix
>>> data = csr_matrix([[1], [2], [3], [4], [5]])
>>> condition = [False, True, True, False, True]
>>> mask = safe_mask(data, condition)
>>> data[mask].toarray()
array([[2],
       [3],
       [5]])

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