You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by bu...@apache.org on 2013/11/21 12:33:34 UTC

svn commit: r887510 - in /websites/staging/mahout/trunk/content: ./ users/recommender/recommender-documentation.html

Author: buildbot
Date: Thu Nov 21 11:33:34 2013
New Revision: 887510

Log:
Staging update by buildbot for mahout

Modified:
    websites/staging/mahout/trunk/content/   (props changed)
    websites/staging/mahout/trunk/content/users/recommender/recommender-documentation.html

Propchange: websites/staging/mahout/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Nov 21 11:33:34 2013
@@ -1 +1 @@
-1544127
+1544130

Modified: websites/staging/mahout/trunk/content/users/recommender/recommender-documentation.html
==============================================================================
--- websites/staging/mahout/trunk/content/users/recommender/recommender-documentation.html (original)
+++ websites/staging/mahout/trunk/content/users/recommender/recommender-documentation.html Thu Nov 21 11:33:34 2013
@@ -403,12 +403,14 @@ and flexibility.</p>
 <p>Mahout recommenders are not just for Java; it can be run as an external
 server which exposes recommendation logic to your application via web
 services and HTTP.</p>
-<p>Top-level packages define the Mahout interfaces to these key abstractions:
-<em> DataModel
-</em> UserSimilarity
-<em> ItemSimilarity
-</em> UserNeighborhood
-* Recommender</p>
+<p>Top-level packages define the Mahout interfaces to these key abstractions:</p>
+<ul>
+<li>DataModel</li>
+<li>UserSimilarity</li>
+<li>ItemSimilarity</li>
+<li>UserNeighborhood</li>
+<li>Recommender</li>
+</ul>
 <p>Subpackages of org.apache.mahout.cf.taste.impl hold implementations of
 these interfaces. These are the pieces from which you will build your own
 recommendation engine. That's it! For the academically inclined, Mahout
@@ -417,7 +419,7 @@ recommenders, and a couple other experim
 currently support <em>model-based</em> recommenders.</p>
 <p><a name="RecommenderDocumentation-Architecture"></a></p>
 <h2 id="architecture">Architecture</h2>
-<p>!https://cwiki.apache.org/confluence/download/attachments/22872433/taste-architecture.png!</p>
+<p><img alt="doc" src="../../images/taste-architecture.png" /></p>
 <p>This diagram shows the relationship between various Mahout components in a
 user-based recommender. An item-based recommender system is similar except
 that there are no PreferenceInferrers or Neighborhood algorithms involved.</p>
@@ -548,59 +550,55 @@ Recommender cachingRecommender = new Cac
 
 <p>List<RecommendedItem> recommendations =
       cachingRecommender.recommend(1234, 10);</p>
-<div class="codehilite"><pre><span class="n">h3</span><span class="p">.</span><span class="n">Item</span><span class="o">-</span><span class="n">based</span> <span class="n">Recommender</span>
-
-<span class="n">We</span> <span class="n">could</span> <span class="n">have</span> <span class="n">created</span> <span class="n">an</span> <span class="n">item</span><span class="o">-</span><span class="n">based</span> <span class="n">recommender</span> <span class="n">instead</span><span class="p">.</span> <span class="n">Item</span><span class="o">-</span><span class="n">based</span>
-</pre></div>
-
-
-<p>recommender base recommendation not on user similarity, but on item
+<h2 id="item-based-recommender">Item-based Recommender</h2>
+<p>We could have created an item-based recommender instead. Item-based
+recommender base recommendation not on user similarity, but on item
 similarity. In theory these are about the same approach to the problem,
 just from different angles. However the similarity of two items is
 relatively fixed, more so than the similarity of two users. So, item-based
 recommenders can use pre-computed similarity values in the computations,
 which make them much faster. For large data sets, item-based recommenders
 are more appropriate.</p>
-<div class="codehilite"><pre><span class="n">Let</span><span class="o">&#39;</span><span class="n">s</span> <span class="n">start</span> <span class="n">over</span><span class="p">,</span> <span class="n">again</span> <span class="n">with</span> <span class="n">a</span> <span class="n">FileDataModel</span> <span class="n">to</span> <span class="n">start</span><span class="p">:</span>
-</pre></div>
-
-
-<p>DataModel model = new FileDataModel(new File("data.txt"));</p>
-<div class="codehilite"><pre><span class="n">We</span><span class="o">&#39;</span><span class="n">ll</span> <span class="n">also</span> <span class="n">need</span> <span class="n">an</span> <span class="n">ItemSimilarity</span><span class="p">.</span> <span class="n">We</span> <span class="n">could</span> <span class="n">use</span>
+<p>Let's start over, again with a FileDataModel to start:</p>
+<div class="codehilite"><pre><span class="n">DataModel</span> <span class="n">model</span> <span class="p">=</span> <span class="n">new</span> <span class="n">FileDataModel</span><span class="p">(</span><span class="n">new</span> <span class="n">File</span><span class="p">(</span>&quot;<span class="n">data</span><span class="p">.</span><span class="n">txt</span>&quot;<span class="p">));</span>
 </pre></div>
 
 
-<p>PearsonCorrelationSimilarity, which computes item similarity in realtime,
+<p>We'll also need an ItemSimilarity. We could use
+PearsonCorrelationSimilarity, which computes item similarity in realtime,
 but, this is generally too slow to be useful. Instead, in a real
 application, you would feed a list of pre-computed correlations to a
 GenericItemSimilarity: </p>
-<p>// Construct the list of pre-computed correlations
-Collection<GenericItemSimilarity.ItemItemSimilarity> correlations =
-      ...;
-ItemSimilarity itemSimilarity =
-      new GenericItemSimilarity(correlations);</p>
-<div class="codehilite"><pre><span class="n">Then</span> <span class="n">we</span> <span class="n">can</span> <span class="n">finish</span> <span class="n">as</span> <span class="n">before</span> <span class="n">to</span> <span class="n">produce</span> <span class="n">recommendations</span><span class="p">:</span>
+<div class="codehilite"><pre><span class="c1">// Construct the list of pre-computed correlations</span>
+<span class="n">Collection</span><span class="o">&lt;</span><span class="n">GenericItemSimilarity</span><span class="p">.</span><span class="n">ItemItemSimilarity</span><span class="o">&gt;</span> <span class="n">correlations</span> <span class="o">=</span>
+  <span class="p">...;</span>
+<span class="n">ItemSimilarity</span> <span class="n">itemSimilarity</span> <span class="o">=</span>
+  <span class="k">new</span> <span class="n">GenericItemSimilarity</span><span class="p">(</span><span class="n">correlations</span><span class="p">);</span>
 </pre></div>
 
 
-<p>Recommender recommender =
-      new GenericItemBasedRecommender(model, itemSimilarity);
-Recommender cachingRecommender = new CachingRecommender(recommender);
-...
-List<RecommendedItem> recommendations =
-      cachingRecommender.recommend(1234, 10);</p>
-<div class="codehilite"><pre><span class="n">h3</span><span class="p">.</span> <span class="n">Slope</span><span class="o">-</span><span class="n">One</span> <span class="n">Recommender</span>
-<span class="n">This</span> <span class="n">is</span> <span class="n">a</span> <span class="n">simple</span> <span class="n">yet</span> <span class="n">effective</span> <span class="n">Recommender</span> <span class="n">and</span> <span class="n">we</span> <span class="n">present</span> <span class="n">another</span> <span class="n">example</span>
+<p>Then we can finish as before to produce recommendations:</p>
+<div class="codehilite"><pre><span class="n">Recommender</span> <span class="n">recommender</span> <span class="p">=</span>
+  <span class="n">new</span> <span class="n">GenericItemBasedRecommender</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">itemSimilarity</span><span class="p">);</span>
+<span class="n">Recommender</span> <span class="n">cachingRecommender</span> <span class="p">=</span> <span class="n">new</span> <span class="n">CachingRecommender</span><span class="p">(</span><span class="n">recommender</span><span class="p">);</span>
+<span class="p">...</span>
+<span class="n">List</span><span class="o">&lt;</span><span class="n">RecommendedItem</span><span class="o">&gt;</span> <span class="n">recommendations</span> <span class="p">=</span>
+  <span class="n">cachingRecommender</span><span class="p">.</span><span class="n">recommend</span><span class="p">(</span>1234<span class="p">,</span> 10<span class="p">);</span>
+</pre></div>
+
+
+<h2 id="slope-one-recommender">Slope-One Recommender</h2>
+<p>This is a simple yet effective Recommender and we present another example
+to round out the list:</p>
+<div class="codehilite"><pre><span class="n">DataModel</span> <span class="n">model</span> <span class="p">=</span> <span class="n">new</span> <span class="n">FileDataModel</span><span class="p">(</span><span class="n">new</span> <span class="n">File</span><span class="p">(</span>&quot;<span class="n">data</span><span class="p">.</span><span class="n">txt</span>&quot;<span class="p">));</span>
+  <span class="o">//</span> <span class="n">Make</span> <span class="n">a</span> <span class="n">weighted</span> <span class="n">slope</span> <span class="n">one</span> <span class="n">recommender</span>
+  <span class="n">Recommender</span> <span class="n">recommender</span> <span class="p">=</span> <span class="n">new</span> <span class="n">SlopeOneRecommender</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
+  <span class="n">Recommender</span> <span class="n">cachingRecommender</span> <span class="p">=</span> <span class="n">new</span>
+<span class="n">CachingRecommender</span><span class="p">(</span><span class="n">recommender</span><span class="p">);</span>
+<span class="p">{</span><span class="n">code</span><span class="p">}</span>
 </pre></div>
 
 
-<p>to round out the list:</p>
-<p>DataModel model = new FileDataModel(new File("data.txt"));
-      // Make a weighted slope one recommender
-      Recommender recommender = new SlopeOneRecommender(model);
-      Recommender cachingRecommender = new
-CachingRecommender(recommender);
-    {code}</p>
 <p><a name="RecommenderDocumentation-Integrationwithyourapplication"></a></p>
 <h2 id="integration-with-your-application">Integration with your application</h2>
 <p><a name="RecommenderDocumentation-Direct"></a></p>
@@ -701,12 +699,7 @@ are more meaningful:</p>
 <p>You'll want to look at these packages too, which offer more algorithms and
 approaches that you may find useful:</p>
 <ul>
-<li>
-<dl>
-<dt><a href="http://www.nongnu.org/cofi/">Cofi</a></dt>
-<dd>A Java-Based Collaborative Filtering Library</dd>
-</dl>
-</li>
+<li><a href="http://www.nongnu.org/cofi/">Cofi</a>: A Java-Based Collaborative Filtering Library</li>
 <li><a href="http://eecs.oregonstate.edu/iis/CoFE/">CoFE</a></li>
 </ul>
 <p>Here's a handful of research papers that I've read and found particularly
@@ -731,11 +724,13 @@ Research and Development in Information 
 <p>Michelle Anderson, Marcel Ball, Harold Boley, Stephen Greene, Nancy Howse, Daniel Lemire and Sean McGrath, "<a href="http://www.daniel-lemire.com/fr/documents/publications/racofi_nrc.pdf">RACOFI: A Rule-Applying Collaborative Filtering System</a>
 "," Proceedings of COLA '03, 2003.</p>
 <p>These links will take you to all the collaborative filtering reading you
-could ever want!
-<em> <a href="http://www.paulperry.net/notes/cf.asp">Paul Perry's notes</a>
-</em> <a href="http://jamesthornton.com/cf/">James Thornton's collaborative filtering resources</a>
-* <a href="http://www.daniel-lemire.com/blog/">Daniel Lemire's blog</a>
- which frequently covers collaborative filtering topics</p>
+could ever want!</p>
+<ul>
+<li><a href="http://www.paulperry.net/notes/cf.asp">Paul Perry's notes</a></li>
+<li><a href="http://jamesthornton.com/cf/">James Thornton's collaborative filtering resources</a></li>
+<li><a href="http://www.daniel-lemire.com/blog/">Daniel Lemire's blog</a>
+ which frequently covers collaborative filtering topics</li>
+</ul>
    </div>
   </div>     
 </div>