sklearn.utils#
Various utilities to help with development.
Developer guide. See the Utilities for Developers section for further details.
Container object exposing keys as attributes. |
|
Return rows, items or columns of X using indices. |
|
Convert an array-like to an array of floats. |
|
Throw a ValueError if X contains NaN or infinity. |
|
Decorator to mark a function or class as deprecated. |
|
Build a HTML representation of an estimator. |
|
Generator to create slices containing |
|
Generator to create |
|
Make arrays indexable for cross-validation. |
|
Compute the 32bit murmurhash3 of key at seed. |
|
Resample arrays or sparse matrices in a consistent way. |
|
Return a mask which is safe to use on X. |
|
Element wise squaring of array-likes and sparse matrices. |
|
Shuffle arrays or sparse matrices in a consistent way. |
Input and parameter validation#
Functions to validate input and parameters within scikit-learn estimators.
Input validation for standard estimators. |
|
Input validation on an array, list, sparse matrix or similar. |
|
Check that all arrays have consistent first dimensions. |
|
Turn seed into a np.random.RandomState instance. |
|
Validate scalar parameters type and value. |
|
Perform is_fitted validation for estimator. |
|
Check that |
|
Make sure that array is 2D, square and symmetric. |
|
Ravel column or 1d numpy array, else raises an error. |
|
Check whether the estimator's fit method supports the given parameter. |
Meta-estimators#
Utilities for meta-estimators.
An attribute that is available only if check returns a truthy value. |
Weight handling based on class labels#
Utilities for handling weights based on class labels.
Estimate class weights for unbalanced datasets. |
|
Estimate sample weights by class for unbalanced datasets. |
Dealing with multiclass target in classifiers#
Utilities to handle multiclass/multioutput target in classifiers.
Check if |
|
Determine the type of data indicated by the target. |
|
Extract an ordered array of unique labels. |
Optimal mathematical operations#
Utilities to perform optimal mathematical operations in scikit-learn.
Compute density of a sparse vector. |
|
Compute logarithm of determinant of a square matrix. |
|
Compute an orthonormal matrix whose range approximates the range of A. |
|
Compute a truncated randomized SVD. |
|
Dot product that handle the sparse matrix case correctly. |
|
Return an array of the weighted modal (most common) value in the passed array. |
Working with sparse matrices and arrays#
A collection of utilities to work with sparse matrices and arrays.
Compute incremental mean and variance along an axis on a CSR or CSC matrix. |
|
Inplace column scaling of a CSC/CSR matrix. |
|
Inplace column scaling of a CSR matrix. |
|
Inplace row scaling of a CSR or CSC matrix. |
|
Swap two columns of a CSC/CSR matrix in-place. |
|
Swap two rows of a CSC/CSR matrix in-place. |
|
Compute mean and variance along an axis on a CSR or CSC matrix. |
Utilities to work with sparse matrices and arrays written in Cython.
Normalize inplace the rows of a CSR matrix or array by their L1 norm. |
|
Normalize inplace the rows of a CSR matrix or array by their L2 norm. |
Working with graphs#
Graph utilities and algorithms.
Return the length of the shortest path from source to all reachable nodes. |
Random sampling#
Utilities for random sampling.
Sample integers without replacement. |
Auxiliary functions that operate on arrays#
A small collection of auxiliary functions that operate on arrays.
Find the minimum value of an array over positive values. |
Metadata routing#
Utilities to route metadata within scikit-learn estimators.
User guide. See the Metadata Routing section for further details.
Contains the metadata request info of a consumer. |
|
Stores and handles metadata routing for a router object. |
|
Stores the mapping between caller and callee methods for a router. |
|
Get a |
|
Validate and route input parameters. |
Discovering scikit-learn objects#
Utilities to discover scikit-learn objects.
Get a list of all displays from |
API compatibility checkers#
Various utilities to check the compatibility of estimators with scikit-learn API.
Check if estimator adheres to scikit-learn conventions. |
|
Pytest specific decorator for parametrizing estimator checks. |
Parallel computing#
Customizations of joblib
tools for scikit-learn usage.
Tweak of |
|
Decorator used to capture the arguments of a function. |