Session Ready
Exercise

Trying different N-NMF algorithms

The main differences between the algorithms are in the computation of the objective function and the optimization techniques used for the update steps. By default, the NMF package runs brunet, but you can choose any of the 11 algorithms implemented within the NMF package, and put it as the third argument of nmf(). For browsing through the available N-NMF algorithms implemented in NMF you can simply use the nmfAlgorithm() function. Using nmfAlgorithm() without arguments, a vector with all the 11 algorithms, optimized in C++, is returned. For extracting the older versions of some of these algorithms, written in R, you can use the version argument and set it to R in order to get the older versions. Let's put all this into practice!

Instructions
100 XP
  • Ask for the algorithms implemented within the nmf package and store the result to alg.
  • Choose the old implementations of the algorithms, written in R, and store the result to R_alg. Check out which of the arguments of the relevant function is the correct for picking R's version of the algorithms.
  • Get a 5-rank approximation of corpus_tdm with R_alg, the vector of algorithms written in R, as the third argument of nmf(). Don't forget to ask for a verbose output.