Author: buildbot
Date: Tue Aug 11 23:40:36 2015
New Revision: 961554
Log:
Staging update by buildbot for mahout
Modified:
websites/staging/mahout/trunk/content/ (props changed)
websites/staging/mahout/trunk/content/users/recommender/intro-als-hadoop.html
Propchange: websites/staging/mahout/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Tue Aug 11 23:40:36 2015
@@ -1 +1 @@
-1695404
+1695410
Modified:
websites/staging/mahout/trunk/content/users/recommender/intro-als-hadoop.html
==============================================================================
---
websites/staging/mahout/trunk/content/users/recommender/intro-als-hadoop.html
(original)
+++
websites/staging/mahout/trunk/content/users/recommender/intro-als-hadoop.html
Tue Aug 11 23:40:36 2015
@@ -263,8 +263,19 @@
<div id="content-wrap" class="clearfix">
<div id="main">
- <h1 id="introduction-to-als-recommendations-with-hadoop">Introduction to
ALS Recommendations with Hadoop</h1>
-<h2 id="overview">Overview</h2>
+ <style type="text/css">
+/* The following code is added by mdx_elementid.py
+ It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+ visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink,
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink,
dt:hover > .elementid-permalink { visibility: visible }</style>
+<h1 id="introduction-to-als-recommendations-with-hadoop">Introduction to ALS
Recommendations with Hadoop<a class="headerlink"
href="#introduction-to-als-recommendations-with-hadoop" title="Permanent
link">¶</a></h1>
+<h2 id="overview">Overview<a class="headerlink" href="#overview"
title="Permanent link">¶</a></h2>
<p>Mahoutâs ALS recommender is a matrix factorization algorithm that uses
Alternating Least Squares with Weighted-Lamda-Regularization (ALS-WR). It
factors the user to item matrix <em>A</em> into the user-to-feature matrix
<em>U</em> and the item-to-feature matrix <em>M</em>: It runs the ALS algorithm
in a parallel fashion. The algorithm details can be referred to in the
following papers: </p>
<ul>
<li><a
href="http://www.hpl.hp.com/personal/Robert_Schreiber/papers/2008%20AAIM%20Netflix/netflix_aaim08%28submitted%29.pdf">Large-scale
Parallel Collaborative Filtering for
@@ -274,7 +285,7 @@ the Netflix Prize</a></li>
<p>This recommendation algorithm can be used in eCommerce platform to
recommend products to customers. Unlike the user or item based recommenders
that computes the similarity of users or items to make recommendations, the ALS
algorithm uncovers the latent factors that explain the observed user to item
ratings and tries to find optimal factor weights to minimize the least squares
between predicted and actual ratings.</p>
<p>Mahout's ALS recommendation algorithm takes as input user preferences by
item and generates an output of recommending items for a user. The input
customer preference could either be explicit user ratings or implicit feedback
such as user's click on a web page.</p>
<p>One of the strengths of the ALS based recommender, compared to the user or
item based recommender, is its ability to handle large sparse data sets and its
better prediction performance. It could also gives an intuitive rationale of
the factors that influence recommendations.</p>
-<h2 id="implementation">Implementation</h2>
+<h2 id="implementation">Implementation<a class="headerlink"
href="#implementation" title="Permanent link">¶</a></h2>
<p>At present Mahout has a map-reduce implementation of ALS, which is composed
of 2 jobs: a parallel matrix factorization job and a recommendation job.
The matrix factorization job computes the user-to-feature matrix and
item-to-feature matrix given the user to item ratings. Its input includes:
<pre>
@@ -303,7 +314,7 @@ and it outputs the matrices in sequence
--itemIDIndex: index for item long IDs (necessary if usesLongIDs is true)
</pre>
and it outputs a list of recommended item ids for each user. The predicted
rating between user and item is a dot product of the user's feature vector and
the item's feature vector. </p>
-<h2 id="example">Example</h2>
+<h2 id="example">Example<a class="headerlink" href="#example" title="Permanent
link">¶</a></h2>
<p>Letâs look at a simple example of how we could use Mahoutâs ALS
recommender to recommend items for users. First, youâll need to get Mahout up
and running, the instructions for which can be found <a
href="https://mahout.apache.org/users/basics/quickstart.html">here</a>. After
you've ensured Mahout is properly installed, weâre ready to run the
example.</p>
<p><strong>Step 1: Prepare test data</strong></p>
<p>Similar to Mahout's item based recommender, the ALS recommender relies on
the user to item preference data: <em>userID</em>, <em>itemID</em> and
<em>preference</em>. The preference could be explicit numeric rating or counts
of actions such as a click (implicit feedback). The test data file is organized
as each line is a tab-delimited string, the 1st field is user id, which must be
numeric, the 2nd field is item id, which must be numeric and the 3rd field is
preference, which should also be a number.</p>
@@ -329,7 +340,7 @@ for item IDs. Then after recommendations
<p>Running the command will execute a series of jobs the final product of
which will be an output file deposited to the output directory specified in the
command syntax. The output directory contains 3 sub-directories: <em>M</em>
stores the item to feature matrix, <em>U</em> stores the user to feature matrix
and userRatings stores the user's ratings on the items. The <em>tempDir</em>
parameter specifies the directory to store the intermediate output of the job,
such as the matrix output in each iteration and each item's average rating.
Using the <em>tempDir</em> will help on debugging.</p>
<p><strong>Step 4: Make Recommendations</strong></p>
<p>Based on the output feature matrices from step 3, we could make
recommendations for users. Enter the following command:</p>
-<div class="codehilite"><pre> $ <span class="n">mahout</span> <span
class="n">recommendfactorized</span> <span class="o">--</span><span
class="n">input</span> $<span class="n">als_input</span> <span
class="o">--</span><span class="n">userFeatures</span> $<span
class="n">als_output</span><span class="o">/</span><span
class="n">U</span><span class="o">/</span> <span class="o">--</span><span
class="n">itemFeatures</span> $<span class="n">als_output</span><span
class="o">/</span><span class="n">M</span><span class="o">/</span> <span
class="o">--</span><span class="n">numRecommendations</span> 1 <span
class="o">--</span><span class="n">output</span> <span
class="n">recommendations</span> <span class="o">--</span><span
class="n">maxRating</span> 1
+<div class="codehilite"><pre> $ <span class="n">mahout</span> <span
class="n">recommendfactorized</span> <span class="o">--</span><span
class="n">input</span> $<span class="n">als_recommender_input</span> <span
class="o">--</span><span class="n">userFeatures</span> $<span
class="n">als_output</span><span class="o">/</span><span
class="n">U</span><span class="o">/</span> <span class="o">--</span><span
class="n">itemFeatures</span> $<span class="n">als_output</span><span
class="o">/</span><span class="n">M</span><span class="o">/</span> <span
class="o">--</span><span class="n">numRecommendations</span> 1 <span
class="o">--</span><span class="n">output</span> <span
class="n">recommendations</span> <span class="o">--</span><span
class="n">maxRating</span> 1
</pre></div>