Virtual Class to Handle Results from Multiple Runs of NMF Algorithms

Description

This class defines a common interface to handle the results from multiple runs of a single NMF algorithm, performed with the nmf method.

Details

Currently, this interface is implemented by two classes, NMFfitX1-class and NMFfitXn-class, which respectively handle the case where only the best fit is kept, and the case where the list of all the fits is returned.

See nmf for more details on the method arguments.

Slots

  1. runtime.allObject of class proc_time that contains CPU times required to perform all the runs.

Methods

  1. basismapsignature(object = "NMFfitX"): Plots a heatmap of the basis matrix of the best fit in object.

  2. coefmapsignature(object = "NMFfitX"): Plots a heatmap of the coefficient matrix of the best fit in object.

    This method adds:

    • an extra special column annotation track for multi-run NMF fits, 'consensus:', that shows the consensus cluster associated to each sample.
    • a column sorting schema 'consensus' that can be passed to argument Colv and orders the columns using the hierarchical clustering of the consensus matrix with average linkage, as returned by consensushc(object). This is also the ordering that is used by default for the heatmap of the consensus matrix as ploted by consensusmap.

  3. consensussignature(object = "NMFfitX"): Pure virtual method defined to ensure consensus is defined for sub-classes of NMFfitX. It throws an error if called.

  4. consensushcsignature(object = "NMFfitX"): Compute the hierarchical clustering on the consensus matrix of object, or on the connectivity matrix of the best fit in object.

  5. consensusmapsignature(object = "NMFfitX"): Plots a heatmap of the consensus matrix obtained when fitting an NMF model with multiple runs.

  6. cophcorsignature(object = "NMFfitX"): Computes the cophenetic correlation coefficient on the consensus matrix of object. All arguments in ... are passed to the method cophcor,matrix.

  7. deviancesignature(object = "NMFfitX"): Returns the deviance achieved by the best fit object, i.e. the lowest deviance achieved across all NMF runs.

  8. dispersionsignature(object = "NMFfitX"): Computes the dispersion on the consensus matrix obtained from multiple NMF runs.

  9. fitsignature(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.

  10. getRNG1signature(object = "NMFfitX"): Returns the RNG settings used for the first NMF run of multiple NMF runs.

  11. ibtermssignature(object = "NMFfitX"): Method for multiple NMF fit objects, which returns the indexes of fixed basis terms from the best fitted model.

  12. metaHeatmapsignature(object = "NMFfitX"): Deprecated method subsituted by consensusmap.

  13. minfitsignature(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.

  14. nmf.equalsignature(x = "NMFfitX", y = "NMF"): Compares two NMF models when at least one comes from multiple NMF runs.

  15. NMFfitXsignature(object = "NMFfitX"): Provides a way to aggregate NMFfitXn objects into an NMFfitX1 object.

  16. nrunsignature(object = "NMFfitX"): Returns the number of NMF runs performed to create object.

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

    See nrun,NMFfitX-method for more details.

  17. predictsignature(object = "NMFfitX"): Returns the cluster membership index from an NMF model fitted with multiple runs.

    Besides the type of clustering available for any NMF models ('columns', 'rows', 'samples', 'features'), this method can return the cluster membership index based on the consensus matrix, computed from the multiple NMF runs.

    See predict,NMFfitX-method for more details.

  18. residualssignature(object = "NMFfitX"): Returns the residuals achieved by the best fit object, i.e. the lowest residual approximation error achieved across all NMF runs.

  19. runtime.allsignature(object = "NMFfitX"): Returns the CPU time required to compute all the NMF runs. It returns NULL if no CPU data is available.

  20. showsignature(object = "NMFfitX"): Show method for objects of class NMFfitX

  21. summarysignature(object = "NMFfitX"): Computes a set of measures to help evaluate the quality of the best fit of the set. The result is similar to the result from the summary method of NMFfit objects. See NMF-class for details on the computed measures. In addition, the cophenetic correlation (cophcor) and dispersion coefficients of the consensus matrix are returned, as well as the total CPU time (runtime.all).

Examples



# generate a synthetic dataset with known classes
n <- 20; counts <- c(5, 2, 3);
V <- syntheticNMF(n, counts)

# perform multiple runs of one algorithm (default is to keep only best fit)
res <- nmf(V, 3, nrun=3)
## # NOTE - CRAN check detected: limiting maximum number of cores [2/4]
## # NOTE - CRAN check detected: limiting maximum number of cores [2/4]
res
## <Object of class: NMFfitX1 >
##   Method: brunet 
##   Runs:  3 
##   RNG:
##    407L, -1379619792L, -814984591L, -329334402L, -651012121L, -743563524L, 2029886413L 
##   Total timing:
##    user  system elapsed 
##   2.120   0.238   2.698
# plot a heatmap of the consensus matrix
## Not run:  consensusmap(res) 

# perform multiple runs of one algorithm (keep all the fits)
res <- nmf(V, 3, nrun=3, .options='k')
## # NOTE - CRAN check detected: limiting maximum number of cores [2/4]
## # NOTE - CRAN check detected: limiting maximum number of cores [2/4]
res
## <Object of class: NMFfitXn >
##   Method: brunet 
##   Runs:  3 
##   RNG:
##    407L, 231516327L, 437946556L, -923989363L, -102261782L, 2102180963L, -127475128L 
##   Total timing:
##    user  system elapsed 
##   3.003   0.307   1.997 
##   Sequential timing:
##    user  system elapsed 
##   0.346   0.000   0.351

See also

Other multipleNMF: NMFfitX1-class, NMFfitXn-class