sklearn.utils.extmath.density

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

Compute density of a sparse vector

Parameters:
w : array_like

The sparse vector

Returns:
float

The density of w, between 0 and 1

Examples using sklearn.utils.extmath.density