sklearn.utils.extmath.density

sklearn.utils.extmath.density(w, **kwargs)[source]

Compute density of a sparse vector

Parameters
warray_like

The sparse vector

Returns
float

The density of w, between 0 and 1