<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Beyond Search &#187; cf</title>
	<atom:link href="http://www.guwendong.com/post/tag/cf/feed" rel="self" type="application/rss+xml" />
	<link>http://www.guwendong.com</link>
	<description>最好走的路越走越难，最难走的路越走越容易</description>
	<lastBuildDate>Tue, 31 Jan 2012 05:30:38 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>推荐系统：协同过滤 之 Item-based Collaborative Filtering</title>
		<link>http://www.guwendong.com/post/2006/item_based_cf.html</link>
		<comments>http://www.guwendong.com/post/2006/item_based_cf.html#comments</comments>
		<pubDate>Fri, 29 Dec 2006 03:36:57 +0000</pubDate>
		<dc:creator>guwendong</dc:creator>
				<category><![CDATA[推荐系统]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[cf]]></category>
		<category><![CDATA[resys]]></category>

		<guid isPermaLink="false">http://www.guwendong.com/post/2006/item_based_cf.html</guid>
		<description><![CDATA[说起 Item-based collaborative filtering，还有一段有意思的争论，是关于它的起源的。
GroupLens 研究小组的 Sarwar 教授等人，于2001年5月在香港召开的第 10 届 WWW 大会上，发表了题为《Item-based Collaborative Filtering Recommendation Algorithms》的 paper[1]。现在看来，这篇 paper 在 Item-based Collaborative Filtering 方面是影响最广的，被引用的次数也最多，基本上见 Item-based 必见此文。在 2000 的时候，同是上文作者之一的 Karypis 曾经完成了《Evaluation of Item-based Top-N Recommendation Algorithms》，但它仅作为明尼苏达计算机系的一篇 Technical Report 进行了发表，可以看作是 paper[1] 的工作基础。
但实际上，早在 1998 年，Amazon 就已经开发出了自己的 Item-based 推荐系统，并投入了使用。同年，当时 Amazon 推荐系统的设计师、现在 Findory 的创始人 Greg，连同 Jacobi 和 Benson，使用“Collaborative Recommendations Using Item-to-Item Similarity [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="推荐系统resys小组线下活动见闻2009-08-22" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wentrue.net%2Fblog%2F%3Fp%3D559&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2010/12/27/1608365.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐系统resys小组线下活动见闻2009-08-22 (@wentrue)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="One Class Collaborative Filtering 单类协同过滤" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.resyschina.com%2F2011%2F04%2Fone-class-collaborative-filtering.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">One Class Collaborative Filtering 单类协同过滤 (@resyschina)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐系统：协同过滤 之 User-based Collaborative Filtering" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/04/1802121.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐系统：协同过滤 之 User-based Collaborative Filtering</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="重磅推荐：Resys Group" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2009%2Fresys_group.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/04/1801976.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">重磅推荐：Resys Group</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐系统：关联规则(3) —— FP-Growth 算法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2008%2Ffpgrowth_algorithm.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/04/1802009.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐系统：关联规则(3) —— FP-Growth 算法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>说起 Item-based collaborative filtering，还有一段有意思的争论，是关于它的起源的。</p>
<p>GroupLens 研究小组的 Sarwar 教授等人，于2001年5月在<a href="http://my.donews.com/clickstone/2006/12/28/nKJSFkoaIePTsLuJsReWodCCTDIXpFHDqrvW/">香港</a>召开的第 10 届 WWW 大会上，发表了题为《<a href="http://grouplens.org/papers/pdf/www10_sarwar.pdf">Item-based Collaborative Filtering Recommendation Algorithms</a>》的 paper[1]。现在看来，这篇 paper 在 Item-based Collaborative Filtering 方面是影响最广的，被引用的次数也最多，基本上见 Item-based 必见此文。在 2000 的时候，同是上文作者之一的 Karypis 曾经完成了《<a href="http://www-users.cs.umn.edu/~karypis/publications/Papers/PDF/itemrs.pdf">Evaluation of Item-based Top-N Recommendation Algorithms</a>》，但它仅作为明尼苏达计算机系的一篇 Technical Report 进行了发表，可以看作是 paper[1] 的工作基础。</p>
<p>但实际上，早在 1998 年，Amazon 就已经开发出了自己的 Item-based 推荐系统，并投入了使用。同年，当时 Amazon 推荐系统的设计师、现在 Findory 的创始人 <a href="http://glinden.blogspot.com/">Greg</a>，连同 Jacobi 和 Benson，使用“<a href="http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&amp;Sect2=HITOFF&amp;p=1&amp;u=%2Fnetahtml%2FPTO%2Fsearch-bool.html&amp;r=1&amp;f=G&amp;l=50&amp;co1=AND&amp;d=PTXT&amp;s1=6,266,649.PN.&amp;OS=PN/6,266,649&amp;RS=PN/6,266,649">Collaborative Recommendations Using Item-to-Item Similarity Mappings</a>”的名字对该项技术申请了专利。但该专利直到 2001 年才正式通过！并且在 Sarwar 等人的 paper[1] 里，并没有标明引用了此专利的内容。Greg 在自己的 blog 上专门撰文说明了此事 <a href="http://glinden.blogspot.com/2005/03/economist-on-personalization.html">[1]</a> <a href="http://glinden.blogspot.com/2006/11/item-to-item-collaborative-filtering.html">[2]</a>，并得到了 Economist 编辑 Tom Standage 的<a href="http://www.economist.com/research/articlesBySubject/displayStory.cfm?story_id=3786361&amp;subjectid=2402943">承认</a>。在 2003 年，Greg 发表了题为《<a href="http://csdl2.computer.org/persagen/DLAbsToc.jsp?resourcePath=/dl/mags/ic/&amp;toc=comp/mags/ic/2003/01/w1toc.xml&amp;DOI=10.1109/MIC.2003.1167344">Amazon.com Recommendations: Item-to-Item Collaborative Filtering</a>》的 paper，对 1998 年的专利内容进行了详细的说明。</p>
<p>这是一段挺有意思的事情。但更能引起我兴趣的，是这项已经被实践证明确实行之有效的技术——Item-based (or item-to-item) collaborative filtering ！</p>
<p>Item-based 方法也有一个基本的假设：能够引起用户兴趣的项，必定与其之前评分高的项相似。这个假设也是与我们日常生活中的行为相一致的，基本上喜欢《长尾理论》的人，都会去看《世界是平的》，不知道你怎么想，反正<a href="http://www.douban.com/subject/1919072/">豆瓣就是这么认为</a>的。</p>
<p>同 User-based 方法类似，Item-based 方法需要同样的三个步骤：1）得到User-item的评分数据；2）针对项的最近邻搜索，即对项进行相似度计算；3）产生推荐。但相对于 User-based 方法，Item-based 方法最大的改进是提高了协同过滤方法的扩展性及性能。</p>
<p>从<a href="http://my.donews.com/clickstone/2006/12/08/bwoxqowyfevtakinijnyzkxubiajoqdpmrmc/">上一篇</a>中可以看到，在 User-based 方法中，随着用户数量的不断增多，在大数量级的用户范围内进行“最近邻搜索”会成为整个算法的瓶颈。Item-based 方法通过计算项之间的相似性来代替用户之间的相似性。对于项来讲，它们之间的相似性要稳定很多，因此可以离线完成工作量最大的相似性计算步骤，从而大大降低了在线计算量，提高推荐效率。</p>
<p>在 Item-based 方法中，要对 A 和 B 进行项相似性计算，通常分为两步：1）找出同时对 A 和 B 打过分的组合；2）对这些组合进行相似度计算，常用的算法包括：皮尔森相关系数、余弦相似性、调整余弦相似性和条件概率等。</p>
<p>在 paper[1] 里，Sarwar 教授通过试验得到 Item-based 方法的推荐效果要略好于 User-based 方法的结伦。但其实这也并不尽然。在 2003 年，<a href="http://www.cs.utexas.edu/~ramdas/pubs/cbcf.pdf">Mild</a> 教授从批判的角度重新审视了各种推荐算法，指出基于 Item-based 方法并不一定好，算法准确度与采用的实验数据数据有关，大多数情况下还是 User-based 方法好。我个人倒是认为，其实没有绝对的好坏之分，而应该根据问题的不同和数据集的特点，选择最合适的方法。</p>
<p>上面所说的偏重于学术界一些，算法的出发点还是基于打分，多数使用的是 <a href="http://movielens.umn.edu/">MovieLens</a> 的数据。工业界实际使用的多是在基本 Item-based 方法基础上的变形，例如基于关联规则的方法，这些方法最大的变化就是在计算项的相似度方面做文章。其实正如 Greg <a href="http://glinden.blogspot.com/2006/08/chance-to-play-with-big-data.html">曾经说过</a>的，协同过滤最大的特点是“以数据为先”的，只当有了大量的数据积累，才可能找到最有效的、最适宜的方法。</p>
<p>后面我将会陆续写一些实际算法方面的东西，欢迎互动交流。</p>
<p>还有一些图片，不过也得等海那边的光缆修好之后，我才能发上来。</p>
<hr id="rss-footer" />
<small>© guwendong for <a href="http://www.guwendong.com">Beyond Search</a>, 2006.<br/>
本文网址：<a href="http://www.guwendong.com/post/2006/item_based_cf.html">http://www.guwendong.com/post/2006/item_based_cf.html</a><br/>
tags: <a href="http://www.guwendong.com/post/tag/algorithm" rel="tag">algorithm</a>, <a href="http://www.guwendong.com/post/tag/cf" rel="tag">cf</a>, <a href="http://www.guwendong.com/post/tag/resys" rel="tag">resys</a> | <a href="http://www.guwendong.com/post/2006/item_based_cf.html#comments">参与讨论</a>
</small><br><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="推荐系统resys小组线下活动见闻2009-08-22" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wentrue.net%2Fblog%2F%3Fp%3D559&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2010/12/27/1608365.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐系统resys小组线下活动见闻2009-08-22 (@wentrue)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="One Class Collaborative Filtering 单类协同过滤" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.resyschina.com%2F2011%2F04%2Fone-class-collaborative-filtering.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">One Class Collaborative Filtering 单类协同过滤 (@resyschina)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐系统：协同过滤 之 User-based Collaborative Filtering" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/04/1802121.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐系统：协同过滤 之 User-based Collaborative Filtering</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="重磅推荐：Resys Group" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2009%2Fresys_group.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/04/1801976.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">重磅推荐：Resys Group</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐系统：关联规则(3) —— FP-Growth 算法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2008%2Ffpgrowth_algorithm.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/04/1802009.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐系统：关联规则(3) —— FP-Growth 算法</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.guwendong.com/post/2006/item_based_cf.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>推荐系统：协同过滤 之 User-based Collaborative Filtering</title>
		<link>http://www.guwendong.com/post/2006/user_based_cf.html</link>
		<comments>http://www.guwendong.com/post/2006/user_based_cf.html#comments</comments>
		<pubDate>Fri, 08 Dec 2006 07:53:30 +0000</pubDate>
		<dc:creator>guwendong</dc:creator>
				<category><![CDATA[推荐系统]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[cf]]></category>
		<category><![CDATA[resys]]></category>

		<guid isPermaLink="false">http://www.guwendong.com/post/2006/user_based_cf.html</guid>
		<description><![CDATA[协同过滤（Collaborative Filtering）技术，是推荐系统中应用最为广泛的技术之一。顾名思义，“Collaborative” 本身就已经说明了协同过滤算法的主要意思，它基于一组兴趣相同的用户进行推荐。协同过滤基于这样的假设：为用户找到他真正感兴趣的内容的好方法是，首先找他与他兴趣相似的用户，然后将这些用户感兴趣的内容推荐给此用户。这个基本思想是不是和现在颇为流行的“口碑传播(word-of-mouth)”有点儿类似？其实这个非常直观，相信大家都有体会，在现实生活里，对自己最有效的信息，往往是来自于朋友们的推荐。
协同过滤技术可以分为三类：基于用户（User-based）的协同过滤；基于项目（Item-based）的协同过滤；基于模型（Model-based）的协同过滤。这篇文章针对基于用户（User-based）的协同过滤技术。建立一个基于用户的协同过滤系统通常需要三个步骤。
步骤一，收集可以代表用户兴趣的信息。
传统的系统一般使用打分的方式，最著名的例如 MovieLens 。豆瓣上经常出现在右侧的“我来评价”也是这种方法。这种方式被称为“显式评分”方法。但它有一个明显的缺点，收集数据比较困难，用户通常并不愿意费力气为你贡献这种数据。这导致这种系统通常更多出现在实验室或者论文里面。在实际的商业系统中，即使使用了这种方法，也多会被包装为一种更加 user-friendly 的样子。
另外一种被认为更有效的方法是“隐式评分”方法。这种方法不需要用户直接输入评价数据，而是根据用户的行为特征由系统代替用户完成评价。一种研究得比较多的方法是 Web Mining 。电子商务网站在隐式评分的数据获取上有先天的优势，用户购买的商品记录是非常有用的数据。你在豆瓣上写书评，其实也是在为豆瓣贡献着这种评分数据。
步骤二，最近邻搜索。
协同过滤的出发点是与你兴趣相同的一组用户，术语叫做“最近邻”。最近邻搜索的核心是计算两个用户的相似度。例如用户A和用户B，首先需要获取用户A和用户B所有的评分项，然后选择一个合适的相似度计算方法，基于评分项数据，计算得到用户A和用户B的相似度数值。目前使用比较多的相似度算法包括，皮尔森相关系数（Person Correlation Coefficient）、余弦相似性（Cosine-based Similarity）以及调整余弦相似性（Adjusted Consine Similarity）。这里有一个试验，结论是“调整余弦相似性”算法的准确性较好。不知道豆瓣使用的是哪种算法？肯定不会仅使用一种，通常情况下，会根据数据集的不同选择不同的算法。
步骤三，生成推荐结果。
有了最近邻集合，就可以对目标用户的兴趣进行预测，生成推荐结果。通常根据推荐目的的不同，可以进行多种形式的推荐。最常见的推荐结果有两种，Top-N 推荐和关联推荐。
Top-N 推荐，这里的 Top-N 和一般网站（比如 digg）上见到的“最热门”列表是不同的。热门列表是基于全部数据集产生的，它对每个人都是一样的；Top-N 推荐是针对单个用户产生的，它对每个人是不一样的：通过对你的最近邻用户进行统计，选择出现频率最高且在你的评分项目中不存在的项目作为推荐结果。豆瓣上的“排行”栏目，应该是传统的“热门”列表，不是 Top-N 推荐。
关联推荐，也称为基于关联规则的推荐。与传统关联规则针对全部数据进行挖掘不同的是，此方法仅对最近邻用户的购买记录进行关联规则挖掘。如果你曾经购买过关联规则左边的商品，而没有购买过关联规则右边的商品，那么就把右边的这个商品推荐给你。它最突出的优点就是，可以帮助你发现你感兴趣的而以前却从来没有注意过的商品。在 Amazon 介绍书的详细信息的页面上，可以看到这种推荐的一个实际应用。例如在《The Search》的页面上，Amazon 给我的推荐是，

基于用户的协同推荐算法随着用户数量的增多，计算量成线性加大，其性能会越来越差。而对于 Web 应用系统，响应速度绝是影响用户体验的最重要因素之一。这一点极大的限制了基于用户的协同过滤技术在实际系统中的使用。Amazon 更多地使用了基于项目（Item-based）的协同过滤技术，而且随着 Amazon 的成功，Item-based 方法也大为流行起来。豆瓣主要使用的也是 Item-based 方法。在下一篇文章里，我会重点介绍 Item-based 方法。
Answers 上面关于 Collaborative Filtering 的 Topic 是一个好的学习起点。另外在 del.icio.us 上可以找到不少关于协同过滤的资料。

© guwendong for Beyond Search, 2006.
本文网址：http://www.guwendong.com/post/2006/user_based_cf.html
tags: algorithm, cf, resys &#124; 参与讨论
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="推荐系统resys小组线下活动见闻2009-08-22" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wentrue.net%2Fblog%2F%3Fp%3D559&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2010/12/27/1608365.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐系统resys小组线下活动见闻2009-08-22 (@wentrue)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IBM CRL at Resys Group，活动总结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wentrue.net%2Fblog%2F%3Fp%3D865&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2010/12/27/1608363.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IBM CRL at Resys Group，活动总结 (@wentrue)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐系统：协同过滤 之 Item-based Collaborative Filtering" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐系统：协同过滤 之 Item-based Collaborative Filtering</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="重磅推荐：Resys Group" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2009%2Fresys_group.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/04/1801976.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">重磅推荐：Resys Group</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Social Media Algorithm: Hacker News" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2009%2Fsocial_media_algorithm_hackernews.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/05/1801986.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Social Media Algorithm: Hacker News</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>协同过滤（Collaborative Filtering）技术，是推荐系统中应用最为广泛的技术之一。顾名思义，“Collaborative” 本身就已经说明了协同过滤算法的主要意思，它基于一组兴趣相同的用户进行推荐。协同过滤基于这样的假设：为用户找到他真正感兴趣的内容的好方法是，首先找他与他兴趣相似的用户，然后将这些用户感兴趣的内容推荐给此用户。这个基本思想是不是和现在颇为流行的“口碑传播(word-of-mouth)”有点儿类似？其实这个非常直观，相信大家都有体会，在现实生活里，对自己最有效的信息，往往是来自于朋友们的推荐。</p>
<p>协同过滤技术可以分为三类：基于用户（User-based）的协同过滤；基于项目（Item-based）的协同过滤；基于模型（Model-based）的协同过滤。这篇文章针对基于用户（User-based）的协同过滤技术。建立一个基于用户的协同过滤系统通常需要三个步骤。</p>
<p>步骤一，收集可以代表用户兴趣的信息。<img align="right" src="http://static.flickr.com/117/317136772_2fb873a6ac_m.jpg"><br />
传统的系统一般使用打分的方式，最著名的例如 <a href="http://movielens.umn.edu/">MovieLens</a> 。<a href="http://www.douban.com/">豆瓣</a>上经常出现在右侧的“我来评价”也是这种方法。这种方式被称为“显式评分”方法。但它有一个明显的缺点，收集数据比较困难，用户通常并不愿意费力气为你贡献这种数据。这导致这种系统通常更多出现在实验室或者论文里面。在实际的商业系统中，即使使用了这种方法，也多会被包装为一种更加 user-friendly 的样子。<br />
另外一种被认为更有效的方法是“隐式评分”方法。这种方法不需要用户直接输入评价数据，而是根据用户的行为特征由系统代替用户完成评价。一种研究得比较多的方法是 <a href="http://www.answers.com/topic/web-mining">Web Mining</a> 。电子商务网站在隐式评分的数据获取上有先天的优势，用户购买的商品记录是非常有用的数据。你在豆瓣上写书评，其实也是在为豆瓣贡献着这种评分数据。</p>
<p>步骤二，最近邻搜索。<img width="235" height="146" align="right" src="http://www10.cse.cuhk.edu.hk/cdrom/papers/519/img35.gif"><br />
协同过滤的出发点是与你兴趣相同的一组用户，术语叫做“最近邻”。最近邻搜索的核心是计算两个用户的相似度。例如用户A和用户B，首先需要获取用户A和用户B所有的评分项，然后选择一个合适的相似度计算方法，基于评分项数据，计算得到用户A和用户B的相似度数值。目前使用比较多的相似度算法包括，皮尔森相关系数（Person Correlation Coefficient）、余弦相似性（Cosine-based Similarity）以及调整余弦相似性（Adjusted Consine Similarity）。这里有<a href="http://www10.cse.cuhk.edu.hk/cdrom/papers/519/node28.html">一个试验</a>，结论是“调整余弦相似性”算法的准确性较好。不知道豆瓣使用的是哪种算法？肯定不会仅使用一种，通常情况下，会根据数据集的不同选择不同的算法。</p>
<p>步骤三，生成推荐结果。<br />
有了最近邻集合，就可以对目标用户的兴趣进行预测，生成推荐结果。通常根据推荐目的的不同，可以进行多种形式的推荐。最常见的推荐结果有两种，Top-N 推荐和关联推荐。<br />
Top-N 推荐，这里的 Top-N 和一般网站（比如 <a href="http://www.digg.com/">digg</a>）上见到的“最热门”列表是不同的。热门列表是基于全部数据集产生的，它对每个人都是一样的；Top-N 推荐是针对单个用户产生的，它对每个人是不一样的：通过对你的最近邻用户进行统计，选择出现频率最高且在你的评分项目中不存在的项目作为推荐结果。豆瓣上的“排行”栏目，应该是传统的“热门”列表，不是 Top-N 推荐。<br />
关联推荐，也称为基于关联规则的推荐。与传统关联规则针对全部数据进行挖掘不同的是，此方法仅对最近邻用户的购买记录进行关联规则挖掘。如果你曾经购买过关联规则左边的商品，而没有购买过关联规则右边的商品，那么就把右边的这个商品推荐给你。它最突出的优点就是，可以帮助你发现你感兴趣的而以前却从来没有注意过的商品。在 Amazon 介绍书的详细信息的页面上，可以看到这种推荐的一个实际应用。例如在《<a href="http://www.amazon.com/Search-Rewrote-Business-Transformed-Culture/dp/B000GUJHBW/sr=1-1/qid=1165590610/ref=pd_bbs_sr_1/103-0911180-0319807?ie=UTF8&amp;s=books">The Search</a>》的页面上，Amazon 给我的推荐是，<br />
<a href="http://www.amazon.com/Search-Rewrote-Business-Transformed-Culture/dp/B000GUJHBW/sr=1-1/qid=1165590610/ref=pd_bbs_sr_1/103-0911180-0319807?ie=UTF8&amp;s=books"><img border="1" src="http://static.flickr.com/104/317134103_d94bbea08d.jpg?v=0"></a></p>
<p>基于用户的协同推荐算法随着用户数量的增多，计算量成线性加大，其性能会越来越差。而对于 Web 应用系统，响应速度绝是影响用户体验的最重要因素之一。这一点极大的限制了基于用户的协同过滤技术在实际系统中的使用。Amazon 更多地使用了基于项目（Item-based）的协同过滤技术，而且随着 Amazon 的成功，Item-based 方法也大为流行起来。豆瓣主要使用的也是 Item-based 方法。在下一篇文章里，我会重点介绍 Item-based 方法。</p>
<p>Answers 上面关于 Collaborative Filtering 的 <a href="http://www.answers.com/topic/collaborative-filtering">Topic</a> 是一个好的学习起点。另外在 del.icio.us 上可以找到不少关于协同过滤的<a href="http://del.icio.us/search/?fr=del_icio_us&amp;p=collaborativefiltering&amp;type=all">资料</a>。</p>
<hr id="rss-footer" />
<small>© guwendong for <a href="http://www.guwendong.com">Beyond Search</a>, 2006.<br/>
本文网址：<a href="http://www.guwendong.com/post/2006/user_based_cf.html">http://www.guwendong.com/post/2006/user_based_cf.html</a><br/>
tags: <a href="http://www.guwendong.com/post/tag/algorithm" rel="tag">algorithm</a>, <a href="http://www.guwendong.com/post/tag/cf" rel="tag">cf</a>, <a href="http://www.guwendong.com/post/tag/resys" rel="tag">resys</a> | <a href="http://www.guwendong.com/post/2006/user_based_cf.html#comments">参与讨论</a>
</small><br><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="推荐系统resys小组线下活动见闻2009-08-22" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wentrue.net%2Fblog%2F%3Fp%3D559&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2010/12/27/1608365.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐系统resys小组线下活动见闻2009-08-22 (@wentrue)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="IBM CRL at Resys Group，活动总结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wentrue.net%2Fblog%2F%3Fp%3D865&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2010/12/27/1608363.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">IBM CRL at Resys Group，活动总结 (@wentrue)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="推荐系统：协同过滤 之 Item-based Collaborative Filtering" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fitem_based_cf.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">推荐系统：协同过滤 之 Item-based Collaborative Filtering</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="重磅推荐：Resys Group" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2009%2Fresys_group.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/04/1801976.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">重磅推荐：Resys Group</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Social Media Algorithm: Hacker News" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2009%2Fsocial_media_algorithm_hackernews.html&from=http%3A%2F%2Fwww.guwendong.com%2Fpost%2F2006%2Fuser_based_cf.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/01/05/1801986.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Social Media Algorithm: Hacker News</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.guwendong.com/post/2006/user_based_cf.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

