Description Usage Arguments Details Value Methods (by generic) References See Also
Generic function that computes the sparseness of an object, as defined by Hoyer (2004). The sparseness quantifies how much energy of a vector is packed into only few components.
In Hoyer (2004), the sparseness is defined for a real vector x as:
(srqt(n) - ||x||_1 / ||x||_2) / (sqrt(n) - 1)
1 2 3 4 5 6 7 | sparseness(x, ...)
## S4 method for signature 'numeric'
sparseness(x)
## S4 method for signature 'matrix'
sparseness(x)
|
x |
an object whose sparseness is computed. |
... |
extra arguments to allow extension |
, where n is the length of x.
The sparseness is a real number in [0,1].
It is equal to 1 if and only if x
contains a single nonzero component,
and is equal to 0 if and only if all components of x
are equal.
It interpolates smoothly between these two extreme values.
The closer to 1 is the sparseness the sparser is the vector.
The basic definition is for a numeric
vector, and is extended for matrices as the
mean sparseness of its column vectors.
usually a single numeric value – in [0,1]
, or a numeric vector.
See each method for more details.
sparseness(x = NMF)
: Compute the sparseness of an object of class NMF
, as the sparseness of
the basis and coefficient matrices computed separately.
It returns the two values in a numeric vector with names ‘basis’ and ‘coef’.
sparseness(x = numeric)
: Base method that computes the sparseness of a numeric vector.
It returns a single numeric value, computed following the definition given in section Description.
sparseness(x = matrix)
: Computes the sparseness of a matrix as the mean sparseness of its column vectors.
It returns a single numeric value.
Hoyer P (2004). “Non-negative matrix factorization with sparseness constraints.” _The Journal of Machine Learning Research_, *5*, 1457-1469. <URL: http://portal.acm.org/citation.cfm?id=1044709>.
Other assess:
purity()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.