This is documentation for an old release of Scikit-learn (version 0.23). Try the latest stable release (version 1.6) or development (unstable) versions.

sklearn.utils.sparsefuncs.inplace_row_scale

sklearn.utils.sparsefuncs.inplace_row_scale(X, scale)[source]

Inplace row scaling of a CSR or CSC matrix.

Scale each row of the data matrix by multiplying with specific scale provided by the caller assuming a (n_samples, n_features) shape.

Parameters
XCSR or CSC sparse matrix, shape (n_samples, n_features)

Matrix to be scaled.

scalefloat array with shape (n_features,)

Array of precomputed sample-wise values to use for scaling.