sklearn.utils.sparsefuncs.mean_variance_axis

sklearn.utils.sparsefuncs.mean_variance_axis(X, axis)[source]

Compute mean and variance along an axix on a CSR or CSC matrix

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

Input data.

axisint (either 0 or 1)

Axis along which the axis should be computed.

Returns
meansfloat array with shape (n_features,)

Feature-wise means

variancesfloat array with shape (n_features,)

Feature-wise variances