sklearn.utils.extmath.density

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

Compute density of a sparse vector.

Parameters:
warray-like

The sparse vector.

**kwargskeyword arguments

Ignored.

Deprecated since version 1.2: **kwargs were deprecated in version 1.2 and will be removed in 1.4.

Returns:
float

The density of w, between 0 and 1.

Examples using sklearn.utils.extmath.density

Classification of text documents using sparse features

Classification of text documents using sparse features