[mlpack-svn] r16323 - mlpack/trunk/src/mlpack/methods/cf

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Feb 20 11:34:54 EST 2014


Author: rcurtin
Date: Thu Feb 20 11:34:54 2014
New Revision: 16323

Log:
Rank is not yet a parameter, but this heuristic from Siddharth improves upon the
previous "rank = 2".


Modified:
   mlpack/trunk/src/mlpack/methods/cf/cf.cpp

Modified: mlpack/trunk/src/mlpack/methods/cf/cf.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/cf/cf.cpp	(original)
+++ mlpack/trunk/src/mlpack/methods/cf/cf.cpp	Thu Feb 20 11:34:54 2014
@@ -97,8 +97,10 @@
 
   // Operations independent of the query:
   // Decompose the sparse data matrix to user and data matrices.
-  // Should this rank be parameterizable?
-  size_t rank = 2;
+  // This is a simple heuristic that picks a rank based on the density of the
+  // dataset between 5 and 105.
+  const double density = (cleanedData.n_nonzero * 100.0) / cleanedData.n_elem;
+  size_t rank = size_t(density) + 5;
 
   // Presently only ALS (via NMF) is supported as an optimizer.  This should be
   // converted to a template when more optimizers are available.



More information about the mlpack-svn mailing list