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.indexable.html below:

indexable — scikit-learn 1.8.dev0 documentation

indexable#
sklearn.utils.indexable(*iterables)[source]#

Make arrays indexable for cross-validation.

Checks consistent length, passes through None, and ensures that everything can be indexed by converting sparse matrices to csr and converting non-iterable objects to arrays.

Parameters:
*iterables{lists, dataframes, ndarrays, sparse matrices}

List of objects to ensure sliceability.

Returns:
resultlist of {ndarray, sparse matrix, dataframe} or None

Returns a list containing indexable arrays (i.e. NumPy array, sparse matrix, or dataframe) or None.

Examples

>>> from sklearn.utils import indexable
>>> from scipy.sparse import csr_matrix
>>> import numpy as np
>>> iterables = [
...     [1, 2, 3], np.array([2, 3, 4]), None, csr_matrix([[5], [6], [7]])
... ]
>>> indexable(*iterables)
[[1, 2, 3], array([2, 3, 4]), None, <...Sparse...dtype 'int64'...shape (3, 1)>]

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