Learn R Programming

NMF (version 0.28)

fit: Extracting Fitted Models

Description

The functions fit and minfit are S4 genetics that extract the best model object and the best fit object respectively, from a collection of models or from a wrapper object.

fit<- sets the fitted model in a fit object. It is meant to be called only when developing new NMF algorithms, e.g. to update the value of the model stored in the starting point.

Usage

fit(object, ...)

fit(object)<-value

minfit(object, ...)

Arguments

object

an object fitted by some algorithm, e.g. as returned by the function nmf.

value

replacement value

...

extra arguments to allow extension

Methods

fit

signature(object = "NMFfit"): Returns the NMF model object stored in slot 'fit'.

fit

signature(object = "NMFfitX"): Returns the model object that achieves the lowest residual approximation error across all the runs.

It is a pure virtual method defined to ensure fit is defined for sub-classes of NMFfitX, which throws an error if called.

fit

signature(object = "NMFfitX1"): Returns the model object associated with the best fit, amongst all the runs performed when fitting object.

Since NMFfitX1 objects only hold the best fit, this method simply returns the NMF model fitted by object -- that is stored in slot ‘fit’.

fit

signature(object = "NMFfitXn"): Returns the best NMF fit object amongst all the fits stored in object, i.e. the fit that achieves the lowest estimation residuals.

fit<-

signature(object = "NMFfit", value = "NMF"): Updates the NMF model object stored in slot 'fit' with a new value.

minfit

signature(object = "NMFfit"): Returns the object its self, since there it is the result of a single NMF run.

minfit

signature(object = "NMFfitX"): Returns the fit object that achieves the lowest residual approximation error across all the runs.

It is a pure virtual method defined to ensure minfit is defined for sub-classes of NMFfitX, which throws an error if called.

minfit

signature(object = "NMFfitX1"): Returns the fit object associated with the best fit, amongst all the runs performed when fitting object.

Since NMFfitX1 objects only hold the best fit, this method simply returns object coerced into an NMFfit object.

minfit

signature(object = "NMFfitXn"): Returns the best NMF model in the list, i.e. the run that achieved the lower estimation residuals.

The model is selected based on its deviance value.

Details

A fit object differs from a model object in that it contains data about the fit, such as the initial RNG settings, the CPU time used, etc..., while a model object only contains the actual modelling data such as regression coefficients, loadings, etc...

That best model is generally defined as the one that achieves the maximum/minimum some quantitative measure, amongst all models in a collection.

In the case of NMF models, the best model is the one that achieves the best approximation error, according to the objective function associated with the algorithm that performed the fit(s).