naginterfaces.library.matop.real_​nmf

naginterfaces.library.matop.real_nmf(a, k=None, w=None, h=None, seed=None, errtol=0.0, maxit=0)[source]

real_nmf computes a non-negative matrix factorization for a real non-negative matrix .

For full information please refer to the NAG Library document for f01sa

https://www.nag.com/numeric/nl/nagdoc_29.3/flhtml/f01/f01saf.html

Parameters
afloat, array-like, shape

The non-negative matrix .

kNone or int, optional

Note: if this argument is None then a default value will be used, determined as follows: dimension 1 of .

, the factorization rank.

This argument is only referenced if you are not supplying initial iterates and .

If you are providing initial iterates and then your supplied value of will be ignored and it will be inferred from those arrays instead.

wNone or float, array-like, shape , optional

If , should be set to an initial iterate for the non-negative matrix factor, .

If , need not be set. real_nmf will generate a random initial iterate.

hNone or float, array-like, shape , optional

If , should be set to an initial iterate for the non-negative matrix factor, .

If , need not be set. real_nmf will generate a random initial iterate.

seedNone or int, optional

Note: if this argument is None then a default value will be used, determined as follows: if : ; otherwise: .

If , the supplied values of and are used for the initial iterate.

If , the value of is used to seed a random number generator for the initial iterates and . See Generating Random Initial Iterates for further details.

errtolfloat, optional

The convergence tolerance for when the Hierarchical Alternating Least Squares iteration has reached a stationary point. If , is used.

maxitint, optional

Specifies the maximum number of iterations to be used. If , is used.

Returns
wfloat, ndarray, shape

The non-negative matrix factor, .

hfloat, ndarray, shape

The non-negative matrix factor, .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

An internal error occurred when generating initial values for and . Please contact NAG.

(errno )

On entry, one of more of the elements of , or were negative.

(errno )

Both or neither of and must be provided.

(errno )

or must be provided.

Warns
NagAlgorithmicWarning
(errno )

The function has failed to converge after iterations. The factorization given by and may still be a good enough approximation to be useful. Alternatively an improved factorization may be obtained by increasing or using different initial choices of and .

Notes

The matrix is factorized into the product of an matrix and a matrix , both with non-negative elements. The factorization is approximate, , with and chosen to minimize the functional

You are free to choose any value for , provided . The product will then be a low-rank approximation to , with rank at most .

real_nmf finds and using an iterative method known as the Hierarchical Alternating Least Squares algorithm. You may specify initial values for and , or you may provide a seed value for real_nmf to generate the initial values using a random number generator.

References

Cichocki, A and Phan, A–H, 2009, Fast local algorithms for large scale nonnegative matrix and tensor factorizations, IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences (E92–A), 708–721

Cichocki, A, Zdunek, R and Amari, S–I, 2007, Hierarchical ALS algorithms for nonnegative matrix and 3D tensor factorization, Lecture Notes in Computer Science (4666), Springer, 169–176

Ho, N–D, 2008, Nonnegative matrix factorization algorithms and applications, PhD Thesis, Univ. Catholique de Louvain