Mf_fit (models.mf_fit)

class nimfa.models.mf_fit.Mf_fit(fit)

Base class for storing MF results.

It contains generic functions and structure for handling the results of MF algorithms. It contains a slot with the fitted MF model and data about parameters and methods used for factorization.

The purpose of this class is to handle in a generic way the results of MF algorithms and acts as a wrapper for the fitted model. Its attribute attribute:: fit contains the fitted model and its configuration can therefore be used directly in following calls to factorization.

fit

The fitted NMF model

algorithm

NMF method of factorization.

n_iter

The number of iterations performed.

n_run

The number of NMF runs performed.

seeding

The seeding method used to seed the algorithm that fitted NMF model.

options

Extra parameters specific to the algorithm used to fit the model.

basis()

Return the matrix of basis vectors.

coef(idx=None)

Return the matrix of mixture coefficients.

Parameters:idx (str with values ‘coef’ or ‘coef1’ (int value of 0 or 1, respectively)) – Name of the matrix (coefficient) matrix. Used only in the multiple NMF model.
distance(metric=None, idx=None)

Return the loss function value. If metric is not supplied, final objective function value associated to the MF algorithm is returned.

Parameters:
  • metric ('str') – Measure of distance between a target matrix and a MF estimate. Metric ‘kl’ and ‘euclidean’ are defined.
  • idx (str with values ‘coef’ or ‘coef1’ (int value of 0 or 1, respectively)) – Name of the matrix (coefficient) matrix. Used only in the multiple NMF model.
fit()

Return the MF algorithm model.

fitted(idx=None)

Compute the estimated target matrix according to the MF algorithm model.

Parameters:idx (str with values ‘coef’ or ‘coef1’ (int value of 0 or 1, respectively)) – Name of the matrix (coefficient) matrix. Used only in the multiple NMF model.
summary(idx=None)

Return generic set of measures to evaluate the quality of the factorization.

Parameters:idx (str with values ‘coef’ or ‘coef1’ (int value of 0 or 1, respectively)) – Name of the matrix (coefficient) matrix. Used only in the multiple NMF model.