<p>Right now, the first line of <code>CF::GetRecommendations()</code> reads</p>

<pre><code>rating = w * h
</code></pre>

<p>which has the issue that the RAM on the system must be equal to the number of items vs. the number of recommendations.  Then, we run tree-based kNN on the rating matrix, which is of high dimension, which will be slow:</p>

<pre><code>// Calculate the neighborhood of the queried users.
// This should be a templatized option.
neighbor::AllkNN a(rating, query);
arma::mat resultingDistances; // Temporary storage.
a.Search(numUsersForSimilarity, neighborhood, resultingDistances);
</code></pre>

<p>But this isn't necessary.  Note that what we are trying to do is find the most similar users (columns), but we have decomposed the input matrix X = W * H.  (H is the matrix that holds the user preferences, depending on how you look at it.)</p>

<p>Now, some quick linear algebra gives us that X.col(i) = W * H.col(i).  But remember, we are looking for the nearest neighbors of X.col(i), so this is equivalent to the nearest neighbors of H.col(i).  Why aren't we searching for the nearest neighbors in the H matrix, then?</p>

<p>A patch for this ticket should also include some information on the speedup obtained (in either a test program or the <code>cf</code> executable), and verification that the module provides the same results (perhaps through the already written tests).</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/406">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFH94tpm_RSZvWfSy0q1yIXnpjpJNks5ntldugaJpZM4Di-rj.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/406"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>