<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.feedsky.com/styles/feedsky0.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" 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/" version="2.0"><channel><atom:link href="http://feed.feedsky.com/dajianghu" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feed.feedsky.com/dajianghu" type="application/rss+xml"></fs:self_link><lastBuildDate>Mon, 22 Feb 2010 17:19:42 GMT</lastBuildDate><title>大浆糊</title><description>浆糊的blog</description><image><url>http://www.feedsky.com/feed/dajianghu/sc/gif</url><title>大浆糊</title><link>http://dajianghu.org</link></image><link>http://dajianghu.org</link><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>1</sy:updateFrequency><language>en</language><pubDate>Mon, 22 Feb 2010 17:19:42 GMT</pubDate><item><title>[译]玩转Twitter数据：用python对好友进行聚类/分组</title><link>http://dajianghu.org/archives/138</link><content:encoded>&lt;h3 class=&quot;post-title entry-title&quot;&gt;原文地址:http://aimotion.blogspot.com/2009/12/playing-with-twitter-data.html&lt;/h3&gt;
&lt;h3 class=&quot;post-title entry-title&quot;&gt;&lt;span id=&quot;goog-gtc-unit-10&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;a href=&quot;http://aimotion.blogspot.com/2009/12/playing-with-twitter-data.html&quot;&gt;玩转Twitter数据：根据好友的状态信息用python对好友进行聚类/分组&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-11&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;大家好，&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 19px;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-12&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;正如我在我的上一帖最后说，我会开写一些文章, 内容是在twitter上寻找新用户的一些尝试&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;（一个实时微博和社会化网络的服务, 用户在这里可以发布最多140字符的消息）。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-13&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;目标是建立一个推荐系统，可以找到和我拥有相同的口味和偏好的新用户。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 19px;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-14&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;这篇文章将介绍有关数据的聚类分析的一些基本概念&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;，聚类分析可用于发现和可视化一组拥有紧密联系的事物, 人,以及观点。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-15&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;为此，文章将会介绍如何收集和准备Twitter提供的数据，以及一些使用常规距离度量的聚类算法。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-16&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;一些图表也将作为图形可视化工具，用于观察聚类算法生成的数据(簇)。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-17&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;实现这些聚类算法的过程, 帮助我了解了如何去设计一个推荐算法. 使用特定距离度量方法去衡量一个用户在社会化网络中的得分.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 19px;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-18&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;在探讨这个问题之前，需要先向读者阐述一下有监督学习和无监督学习之间的差异。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-19&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;有监督学习通过数据和预期结果(标注结果)，去“学习”如何处理新的数据. 通过当时已经&amp;#8221;学&amp;#8221;到的内容对新数据生成一个结果.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-20&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;不过，像聚类算法这样的无监督学习和神经网络或者决策树这类有监督学习是不一样的.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-21&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这类的算法(无监督)不需要用预期的结果(标注数据)去训练。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-22&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;聚类的目的是发现目标数据集合的结构, 而不是去识别数据的模式。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-23&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;具体的说就是利用数据来发现其中存在的独立群组。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-24&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;在这篇和下篇文章中，我们将探讨一些无监督学习，如层次聚类和K-means算法。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-25&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;现在，先从twitter的用户资料入手, 看看当用户的状态更新时(文本消息), 如何将他们进行分组, 并且可以分到同他们的状态(文字)和用词相匹配的小组中。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-26&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;下面，我会介绍我是如何获取数据，处理和聚类这些数据, 最终得到一些有意思的结果。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-27&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;第1步：获取Twitter的数据&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify; font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: normal; font-size-adjust: none; font-stretch: normal;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-28&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;第一步是获取所有twitter的数据。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-29&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;对于本文，我决定分析我自己的twitter社会网络。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-30&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;所以我只关注我的资料和我的朋友(我follow的)的资料。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-31&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;我们的目标是确定我和我的朋友如何进行分组。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-32&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;因此，预期的结果是，同我写类似内容的朋友应该获得和我较近的距离，反之写不同类型内容的朋友应该距离远一点。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-33&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;为了获取数据 &lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;我用了python-twitter库&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-34&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;它是一个twtter api的开源python接口, 可以非常方便的获取twitter数据。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-35&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;进一步的资料可以查看其官方&lt;/span&gt;&lt;/span&gt; &lt;a href=&quot;http://code.google.com/p/python-twitter/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;项目首页&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-36&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;在这个实验中，我从twitter中随机选出100个朋友. 把他们twitter中出现的一些特定词的频率作为聚类的数据.现。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-37&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;下表展示了其中的一个子集。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-38&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;表01 - &lt;/span&gt;&lt;/span&gt; ， &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;用户用词的频率&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_txFWHHNYMJQ/S0twl4aNgmI/AAAAAAAAAaA/E3jB3C9RZsE/s1600-h/Picture+2.png&quot;&gt;&lt;img class=&quot;size-full wp-image-142 aligncenter&quot; title=&quot;picture-2&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-2.png&quot; alt=&quot;picture-2&quot; width=&quot;320&quot; height=&quot;122&quot; /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-39&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;通过用词频率来聚类用户信息，它可能把用户划分成不同的组，在这些组里面用户经常写类似的问题或者风格（如英文或葡萄牙文）。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-40&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;要生成此数据集，你需要下载twitter的用户状态数据，从其中提取出文本，并建立一个词频表。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-41&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;为了下载Twitter数据，我开发了一个自定义版本的Python-twitter库。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-42&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;在模块里面，我开发了一些新函数，用于获取我的朋友在Twitter中的信息。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-43&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;我建议你下载这个模块，并使用它。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-44&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;要下载&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;em&gt;twitterT.py&lt;/em&gt;点击&lt;a href=&quot;http://www.google.com/url?q=http%3A%2F%2Fdl.dropbox.com%2Fu%2F1977573%2FtwitterT.py&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNEuvddjZQpaUUjdcBrSCQ-oCyCWDw&quot;&gt;这里&lt;/a&gt; 。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-45&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;之后，我已经用Twitter的API，获取了twitter上我的和朋友的状态数据。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-46&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;函数&lt;/span&gt;&lt;/span&gt; &lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;getFriendsIds&lt;/span&gt;&lt;/span&gt;&lt;/em&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;是用来得到包括我在内的Twitter的用户ID。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-47&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;你可以看下面的代码片段。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: center;&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: center;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_txFWHHNYMJQ/S0tyJL-9rgI/AAAAAAAAAaI/Fx5oWxX0XYE/s400/Picture+3.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-143&quot; title=&quot;picture-3&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-3.png&quot; alt=&quot;picture-3&quot; width=&quot;324&quot; height=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-48&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;下一步是创建一个函数，将提取所有用户状态信息中的词。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-49&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;在实验中, 我下载了100个用户的最新100条状态信息。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-50&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;下一个片段显示了如何去完成这件事。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_txFWHHNYMJQ/S0tz8Lc2hNI/AAAAAAAAAaY/6vATnrrjc9o/s1600-h/Picture+4.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-144&quot; title=&quot;picture-4&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-4.png&quot; alt=&quot;picture-4&quot; width=&quot;400&quot; height=&quot;223&quot; /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-51&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;下一步是统计每条微博中每个词使用的次数, 并汇总成词表。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-52&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;因为象&amp;#8217;the&amp;#8217;这样的词将在几乎到处出现，你可以只选择词表中你认为有实际意义的词, 来减少词汇总量。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-53&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;我创建了一个英语/葡萄牙语的停用词表，包括了那些可以从你的词表里去掉的词。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-54&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;为了获得更好的效果，这步预处理很重要。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-55&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;你可以下载我的停用词列表&lt;/span&gt;&lt;/span&gt; &lt;a href=&quot;http://www.google.com/url?q=http%3A%2F%2Fdl.dropbox.com%2Fu%2F1977573%2Fstopwords.py&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNGARiYoqQSJRMl9cFvrJXFa7n2jvA&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;在这里&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-56&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;要使用它只需要像这样导入程序：&lt;/span&gt;&lt;/span&gt; import stopwords。&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_txFWHHNYMJQ/S0t3QVfgdvI/AAAAAAAAAag/M2s_qq6U2C4/s1600-h/Picture+5.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-145&quot; title=&quot;picture-5&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-5.png&quot; alt=&quot;picture-5&quot; width=&quot;400&quot; height=&quot;380&quot; /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-57&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;最后一步是使用的单词列表和状态列表，创建一个文本文件，包含了一个大矩阵, 其中是每个用户状态的词频。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-58&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;我使用的模块&lt;/span&gt;&lt;/span&gt; &lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;pickle&lt;/span&gt;&lt;/span&gt;&lt;/em&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;来存储这些表。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-59&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这样做的好处是，你可以很容易地读和写数据，而不会失去对象的类型和避免进一步分析和处理数据。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-60&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;第2步：聚类算法&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-61&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;本文中的类聚算法选择了层次聚类。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-62&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;它的主要思想是通过不断合并两个最相似的组建立一个有层次结构的组集合。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-63&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;每个组初始状态下只有一个单一的元素，在本实验中，就是一个用户的信息数据。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-64&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这个方法在每次计算中先计算每两个组之间的距离，最近的合并在一起，形成一个新的小组。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-65&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;不断重复，直到只有一个组。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-66&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;图1显示了这一过程。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: center;&quot;&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-67&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;图01 - 层次聚类算法在过程&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_txFWHHNYMJQ/S0t5CcCQTEI/AAAAAAAAAao/K03EnK_7TGQ/s1600-h/Picture+6.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-146&quot; title=&quot;picture-6&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-6.png&quot; alt=&quot;picture-6&quot; width=&quot;400&quot; height=&quot;239&quot; /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-68&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;如图，元素的相对位置代表了他们之间的相似程度，两个元素越接近，他们就越类似。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-69&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;你可以看到每两个组（最接近一起）合并组成新的小组，新小组的位置用他们之间的中点来表示。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-70&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;在形成和合并小组的过程中，最后一步将最后剩下的两个小组合并到一块。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-71&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;下一步是定义紧密度&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-72&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;在本文中&lt;/span&gt;&lt;/span&gt; ， &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;我将使用&lt;/span&gt;&lt;/span&gt; &lt;a href=&quot;http://www.google.com/url?q=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPearson_product-moment_correlation_coefficient&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNFQzD0KbqO3CJKFxkls3_a2MTO-lA&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;Pearson correlation&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;(皮尔逊关联系数) ， &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;以确定两个用户数据的相似程度。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-73&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;由于一些twitter状态信息含有较多的条目或比其他更长的条目，因此将在总体上包含更多的单词，Pearson关联系数就是用来解决这个问题的. 试图确定两组数据在之间的线性距离。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-74&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;请记住，pearson关联系数为1.0时表示两个元素匹配程度完美，接近0.0时表示两者没有任何关系。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-75&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;在这里，我们决定使用1减去Pearson关联系数，因为我们想用小的距离来表示两个元素相似。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-76&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;对于层次聚类算法, 首先创建一个组群，每个原始元素就是一个组。函数的主循环中, 通过尝试每两个组和计算他们之间的关联程度, 找出最匹配的两个组。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-77&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;最好的两个组被合并到一个单一组当中。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-78&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这一新组的数据是两个原先组中数据的平均值。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-79&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这个过程重复进行，直到只剩下一个组。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-80&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;您可以在函数&lt;/span&gt;&lt;/span&gt; &lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;hcluster&lt;/span&gt;&lt;/span&gt;&lt;/em&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;中找到全部层次聚类算法的的代码&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-81&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;步骤3：显示结果&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-82&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;树状图可以帮助我们更清楚的解读聚类得到的分组。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-83&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;层次聚类的结果通常都采用树状图，因为树状图可以在一个相对较小的空间内包含大量的信息。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-84&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;树状图是将节点按层次进行组织。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-85&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;对于上面例子的树状图显示在图02。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-86&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;图02 - 可视化的树状图&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_txFWHHNYMJQ/S0t6ydoSOqI/AAAAAAAAAaw/e4CG6RCMY2I/s1600-h/Picture+7.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-147&quot; title=&quot;picture-7&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-7.png&quot; alt=&quot;picture-7&quot; width=&quot;400&quot; height=&quot;176&quot; /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-87&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;树状图不仅利用连接来显示元素最终属于哪个分组，而且也用距离来表示元素之间的差异大小。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-88&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;你可以看到了AB簇距离A和B元素要比DE簇到D,E元素的距离近得多。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-89&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;对图的解读可以可以帮助你确定一个分组中各个元素的相似程度，可以认为是一个分组的紧密度。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-90&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;在这篇文章中&lt;/span&gt;&lt;/span&gt; ， &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;我将使用&lt;a href=&quot;http://www.google.com/url?q=http%3A%2F%2Fpythonware.com%2F&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNFQdggBfRjGjpxbHWi0n7s3Io1omg&quot;&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;http://pythonware.com&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;提供的Python库（PIL）来绘制树状图并以JPG格式保存&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-91&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;用PIL可以方便的用文字和线条生成图像，绘制一个树状图你所需要做的只是准备好文字和连线。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-92&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;在&lt;em&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;twitterClustering.py&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;中可以看到如何绘制树状图的源代码&lt;/span&gt;&lt;/span&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-93&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;你可以在图03中看到我的100个朋友(包括我在内)的聚类结果。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-94&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;调用&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;drawdendrogram&lt;/span&gt;&lt;/span&gt;这个函数&lt;/span&gt;&lt;/span&gt;，它会产生一个名为twitterclust.jpg的树状图。&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: center;&quot;&gt;&lt;strong&gt;&lt;span id=&quot;goog-gtc-unit-95&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;图03 - Twitter朋友聚类树状图&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_txFWHHNYMJQ/S0uELQNe4dI/AAAAAAAAAa4/WOQTERP36gw/s400/twitterClusters.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-148&quot; title=&quot;twitterclusters&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/twitterclusters.jpg&quot; alt=&quot;twitterclusters&quot; width=&quot;248&quot; height=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-96&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;第4步：解读结果&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-97&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;现在，我将解释一下的生成的树状图！&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-98&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;它给了我非常有趣的结果。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-99&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;语言：葡萄牙语x英语&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-100&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt; 有趣的是，聚类算法首先可以将twitter用户分为两个大组。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-101&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;基于葡萄牙语和英语的词频，&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;使用英语和葡萄牙语的用户被区分开。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-102&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;而且我又发现&lt;/span&gt;&lt;/span&gt;，&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;我有相当数量的朋友即用英语又用葡萄牙语&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-103&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;见图04所示。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-104&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;图04 - Twitter朋友树状图&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;a style=&quot;text-decoration: none;&quot; href=&quot;http://3.bp.blogspot.com/_txFWHHNYMJQ/S0y6gp5G4tI/AAAAAAAAAbE/L1ndJCjHAi0/s1600-h/twitterClustersEP.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-149&quot; title=&quot;twitterclustersep&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/twitterclustersep.jpg&quot; alt=&quot;twitterclustersep&quot; width=&quot;248&quot; height=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-105&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;2。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-106&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;Python使用者&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;strong&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-107&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt; 该算法形成的另一个分组是Python语言爱好者的群体。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-108&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;比如我！&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-109&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;聚类算法可以识别出这些写了大量关于python和相关内容的用户&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-110&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;正如你所看到的用户名&lt;/span&gt;&lt;/span&gt;，他们都非常类似：dakerfp，pythonbrasil，apyb，   luciano，planetpython， gvanrossum（Python语言的创造者），pythonstuff和marcelcaraciolo（我）。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-111&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;图05 - 喜欢Python的朋友分组&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;p&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_txFWHHNYMJQ/S0zFLoISmgI/AAAAAAAAAbM/xSrFpa-aFA8/s1600-h/twitterClustersM.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-150&quot; title=&quot;twitterclustersm&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/twitterclustersm.png&quot; alt=&quot;twitterclustersm&quot; width=&quot;248&quot; height=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0000ee;&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-151&quot; title=&quot;picture-31&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-31.png&quot; alt=&quot;picture-31&quot; width=&quot;320&quot; height=&quot;191&quot; /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div style=&quot;text-align: center; text-decoration: underline;&quot;&gt;&lt;a style=&quot;text-decoration: none;&quot; href=&quot;http://3.bp.blogspot.com/_txFWHHNYMJQ/S0zF4Qe_IkI/AAAAAAAAAbU/jOZYvfRpJBI/s1600-h/Picture+3.png&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a style=&quot;text-decoration: none;&quot; href=&quot;http://3.bp.blogspot.com/_txFWHHNYMJQ/S0zF4Qe_IkI/AAAAAAAAAbU/jOZYvfRpJBI/s1600-h/Picture+3.png&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic; font-weight: bold;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-112&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;3。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: italic; font-weight: bold;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-113&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;手机和Symbian系统在Twitter的发言人&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;strong&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-114&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt; 由热衷移动技术和Symbian系统的Twitter用户组成的分组也在树状图中有所体现。&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-116&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;算法把关注手机和symbian(移动操作系统)的用户分到了一块。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;strong&gt;&lt;em&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal; font-weight: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-118&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;光从用户名你就能看出来。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-119&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;一般来说，他们的名字中都有nokia,Symbian或mobile。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-120&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;是不是很有意思？&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-121&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt; 当然 ， &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;名字有很多意思，它只是暗示&lt;/span&gt;&lt;/span&gt;，&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;他可能是一个会讨论手机话题的用户。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-123&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;您可以自己检查这些用户，他们很可能会提到&amp;#8217;mobile&amp;#8217;,'cellphone&amp;#8217;等等。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: bold;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-125&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;图06 &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal;&quot;&gt;-喜欢手机的朋友分组&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_txFWHHNYMJQ/S0zKcIsykgI/AAAAAAAAAbk/GrbUZQEf2T4/s1600-h/twitterClustersMob.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-152&quot; title=&quot;twitterclustersmob&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/twitterclustersmob.png&quot; alt=&quot;twitterclustersmob&quot; width=&quot;248&quot; height=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/_txFWHHNYMJQ/S0zLT1ZZ9DI/AAAAAAAAAb0/QGKr5rftbpY/s1600-h/Picture+2.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-153&quot; title=&quot;picture-21&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-21.png&quot; alt=&quot;picture-21&quot; width=&quot;320&quot; height=&quot;312&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-126&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;下面是一些用户的标签云（词频）：&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;a href=&quot;http://www.google.com/url?q=http%3A%2F%2Ftwitter.com%2Fmarcelcaraciolo&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNG7dtlWOSBjmnY8KcW2T4-Bjwbw9A&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-127&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;marcelcaraciolo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_txFWHHNYMJQ/S0zRRDF98qI/AAAAAAAAAcM/TeCa-XZogqI/s1600-h/Picture+6.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-154&quot; title=&quot;picture-61&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-61.png&quot; alt=&quot;picture-61&quot; width=&quot;320&quot; height=&quot;248&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;a href=&quot;http://www.google.com/url?q=http%3A%2F%2Ftwitter.com%2Fpythonstuff&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNGilfEKcsNe-zLX-VgBKyfjAkPTJw&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-128&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;pythonstuff&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_txFWHHNYMJQ/S0zRQqKXPzI/AAAAAAAAAb8/ToEDFJBqtD0/s1600-h/Picture+4.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-155&quot; title=&quot;picture-41&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-41.png&quot; alt=&quot;picture-41&quot; width=&quot;320&quot; height=&quot;219&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;a href=&quot;http://www.google.com/url?q=http%3A%2F%2Ftwitter.com%2Fsymbianguru&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNGfgonbVs-mm77FxXVH4_3hjynyUw&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-130&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;symbianguru&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_txFWHHNYMJQ/S0zRRfaBAEI/AAAAAAAAAcU/dvJFi4KIrN0/s1600-h/Picture+7.png&quot;&gt;&lt;img class=&quot;aligncenter size-full wp-image-141&quot; title=&quot;picture-71&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2010/02/picture-71.png&quot; alt=&quot;picture-71&quot; width=&quot;320&quot; height=&quot;226&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal; font-weight: bold;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-131&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-tm goog-gtc-from-tm-score-100&quot; dir=&quot;ltr&quot;&gt;结论：&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal; font-weight: bold;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal; font-weight: bold;&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal; font-weight: bold;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-134&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;在这篇文章中我介绍了我第一次尝试对我twitter上的朋友（我follow的）进行聚类分组。为此，我只考虑我朋友的twitter状态信息，并根据&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-135&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;他们写的内容（文本信息），用聚类算法将用户进行分组。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal; font-weight: bold;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-137&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这里所使用的算法是无监督学习方法一种, 叫做层次聚类。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-140&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;它的对数据的聚类效果很好，但它的缺点是计算速度非常慢（消耗的时间和计算能力），因为它需要计算所有元素之间的距离。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal; font-weight: bold;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-145&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这里使用的距离度量方法是Pearson关联系数。通过树状图和标签云显示的结果可以给我们一些有趣的结论。算法成功地将用户聚类到分组中&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal; font-weight: bold;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-150&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;其他技术也同样可以适用于这里。下一篇我将介绍一些其他用于聚类数据的方法, 以及一些功能强大的工具，用于显示分组之间的关系。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal; font-weight: bold;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-151&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;要下载源代码。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: normal; font-weight: bold;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span id=&quot;goog-gtc-unit-152&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;点&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt; &lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;&lt;a href=&quot;http://www.google.com/url?q=http%3A%2F%2Fdl.dropbox.com%2Fu%2F1977573%2FtwitterClustering.zip&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNHOs--4JHwNriN7bO7UUD4vMVFuLg&quot;&gt;&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: georgia;&quot;&gt;这里&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt; 。&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;
&lt;p style=&quot;margin: 0px; text-align: justify;&quot;&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/335041334/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/138&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041334/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041334/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://dajianghu.org/archives/138/feed</wfw:commentRss><description>原文地址:http://aimotion.blogspot.com/2009/12/playing-with-twitter-data.html
玩转Twitter数据：根据好友的状态信息用python对好友进行聚类/分组

大家好，

正如我在我的上一帖最后说，我会开写一些文章, 内容是在twitter上寻找新用户的一些尝试（一个实时微博和社会化网络的服务, 用户在这里可以发布最多140字符的消息）。目标是建立一个推荐系统，可以找到和我拥有相同的口味和偏好的新用户。

这篇文章将介绍有关数据的聚类分析的一些基本概念 ，聚类分析可用于发现和可视化一组拥有紧密联系的事物, 人,以及观点。为此，文章将会介绍如何收集和准备Twitter提供的数据，以及一些使用常规距离度量的聚类算法。一些图表也将作为图形可视化工具，用于观察聚类算法生成的数据(簇)。实现这些聚类算法的过程, 帮助我了解了如何去设计一个推荐算法. 使用特定距离度量方法去衡量一个用户在社会化网络中的得分.

在探讨这个问题之前，需要先向读者阐述一下有监督学习和无监督学习之间的差异。有监督学习通过数据和预期结果(标注结果)，去“学习”如何处理新的数据. 通过当时已经&amp;#8221;学&amp;#8221;到的内容对新数据生成一个结果.不过，像聚类算法这样的无监督学习和神经网络或者决策树这类有监督学习是不一样的.这类的算法(无监督)不需要用预期的结果(标注数据)去训练。聚类的目的是发现目标数据集合的结构, 而不是去识别数据的模式。具体的说就是利用数据来发现其中存在的独立群组。在这篇和下篇文章中，我们将探讨一些无监督学习，如层次聚类和K-means算法。

现在，先从twitter的用户资料入手, 看看当用户的状态更新时(文本消息), 如何将他们进行分组, 并且可以分到同他们的状态(文字)和用词相匹配的小组中。

下面，我会介绍我是如何获取数据，处理和聚类这些数据, 最终得到一些有意思的结果。

第1步：获取Twitter的数据



第一步是获取所有twitter的数据。对于本文，我决定分析我自己的twitter社会网络。所以我只关注我的资料和我的朋友(我follow的)的资料。我们的目标是确定我和我的朋友如何进行分组。因此，预期的结果是，同我写类似内容的朋友应该获得和我较近的距离，反之写不同类型内容的朋友应该距离远一点。为了获取数据 我用了python-twitter库。它是一个twtter api的开源python接口, 可以非常方便的获取twitter数据。进一步的资料可以查看其官方 项目首页。


在这个实验中，我从twitter中随机选出100个朋友. 把他们twitter中出现的一些特定词的频率作为聚类的数据.现。下表展示了其中的一个子集。


表01 -  ， 用户用词的频率



通过用词频率来聚类用户信息，它可能把用户划分成不同的组，在这些组里面用户经常写类似的问题或者风格（如英文或葡萄牙文）。要生成此数据集，你需要下载twitter的用户状态数据，从其中提取出文本，并建立一个词频表。


为了下载Twitter数据，我开发了一个自定义版本的Python-twitter库。在模块里面，我开发了一些新函数，用于获取我的朋友在Twitter中的信息。我建议你下载这个模块，并使用它。要下载 twitterT.py点击这里 。


之后，我已经用Twitter的API，获取了twitter上我的和朋友的状态数据。函数 getFriendsIds 是用来得到包括我在内的Twitter的用户ID。你可以看下面的代码片段。








下一步是创建一个函数，将提取所有用户状态信息中的词。在实验中, 我下载了100个用户的最新100条状态信息。下一个片段显示了如何去完成这件事。








下一步是统计每条微博中每个词使用的次数, 并汇总成词表。因为象&amp;#8217;the&amp;#8217;这样的词将在几乎到处出现，你可以只选择词表中你认为有实际意义的词, 来减少词汇总量。我创建了一个英语/葡萄牙语的停用词表，包括了那些可以从你的词表里去掉的词。为了获得更好的效果，这步预处理很重要。你可以下载我的停用词列表 在这里 。要使用它只需要像这样导入程序： import stopwords。






最后一步是使用的单词列表和状态列表，创建一个文本文件，包含了一个大矩阵, 其中是每个用户状态的词频。我使用的模块 pickle 来存储这些表。这样做的好处是，你可以很容易地读和写数据，而不会失去对象的类型和避免进一步分析和处理数据。




第2步：聚类算法


本文中的类聚算法选择了层次聚类。它的主要思想是通过不断合并两个最相似的组建立一个有层次结构的组集合。每个组初始状态下只有一个单一的元素，在本实验中，就是一个用户的信息数据。这个方法在每次计算中先计算每两个组之间的距离，最近的合并在一起，形成一个新的小组。不断重复，直到只有一个组。图1显示了这一过程。


图01 - 层次聚类算法在过程





如图，元素的相对位置代表了他们之间的相似程度，两个元素越接近，他们就越类似。你可以看到每两个组（最接近一起）合并组成新的小组，新小组的位置用他们之间的中点来表示。在形成和合并小组的过程中，最后一步将最后剩下的两个小组合并到一块。


下一步是定义紧密度 。在本文中 ， 我将使用 Pearson correlation(皮尔逊关联系数) ， 以确定两个用户数据的相似程度。由于一些twitter状态信息含有较多的条目或比其他更长的条目，因此将在总体上包含更多的单词，Pearson关联系数就是用来解决这个问题的. 试图确定两组数据在之间的线性距离。请记住，pearson关联系数为1.0时表示两个元素匹配程度完美，接近0.0时表示两者没有任何关系。在这里，我们决定使用1减去Pearson关联系数，因为我们想用小的距离来表示两个元素相似。


对于层次聚类算法, 首先创建一个组群，每个原始元素就是一个组。函数的主循环中, 通过尝试每两个组和计算他们之间的关联程度, 找出最匹配的两个组。最好的两个组被合并到一个单一组当中。这一新组的数据是两个原先组中数据的平均值。这个过程重复进行，直到只剩下一个组。您可以在函数 hcluster 中找到全部层次聚类算法的的代码 。




步骤3：显示结果


树状图可以帮助我们更清楚的解读聚类得到的分组。层次聚类的结果通常都采用树状图，因为树状图可以在一个相对较小的空间内包含大量的信息。树状图是将节点按层次进行组织。对于上面例子的树状图显示在图02。




图02 - 可视化的树状图



树状图不仅利用连接来显示元素最终属于哪个分组，而且也用距离来表示元素之间的差异大小。你可以看到了AB簇距离A和B元素要比DE簇到D,E元素的距离近得多。对图的解读可以可以帮助你确定一个分组中各个元素的相似程度，可以认为是一个分组的紧密度。


在这篇文章中 ， [...]&lt;img src=&quot;http://www1.feedsky.com/t1/335041334/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/138&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041334/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041334/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><category>twitter</category><category>python</category><category>clustering</category><category>互联网</category><pubDate>Tue, 23 Feb 2010 01:19:42 +0800</pubDate><author>一陀浆糊</author><comments>http://dajianghu.org/archives/138#comments</comments><guid isPermaLink="false">http://dajianghu.org/?p=138</guid><dc:creator>一陀浆糊</dc:creator><fs:srclink>http://dajianghu.org/archives/138</fs:srclink><fs:srcfeed>http://dajianghu.org/feed</fs:srcfeed><fs:itemid>feedsky/dajianghu/~7587916/335041334/5696998</fs:itemid></item><item><title>Hadoop系统背后的数学</title><link>http://dajianghu.org/archives/135</link><content:encoded>&lt;p&gt;原文地址: http://nathanmarz.com/blog/hadoop-mathematics/&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-8&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;我希望我在一年前就知道这些。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-9&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;现在，通过一些简单的数学我终于可以回答下面的问题：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span id=&quot;goog-gtc-unit-10&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;当机器的处理能力加快一倍, 为什么整个系统运行的速度没有增加一倍?&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span id=&quot;goog-gtc-unit-11&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;如果故障率增加10%,为什么整体的运行时间增加了300%?&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span id=&quot;goog-gtc-unit-13&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;为了得到最优的性能和容错表现, 一个计算机群应该部署多少机器？&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-14&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;一个简单的数学公式可以巧妙的回答所有这些问题:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-15&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;运行时间=系统开销/（1 - （1小时数据量的处理时间) ）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-16&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;我们将在稍后证明这个等式。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-17&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;首先，让我们简要地讨论一下“Hadoop为基础的系统。(分布式系统)”&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-18&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;sup class=&quot;footnote&quot;&gt;&lt;a id=&quot;fnref-6-1&quot; href=&quot;http://www.google.com/url?q=http%3A%2F%2Fnathanmarz.com%2Fblog%2Fhadoop-mathematics%2F%23fn-6-1&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNGpeoFa60oCBZd6gHpPGR_CBNBeTw&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; Hadoop的一个常规应用是处理一个连续输入的数据流。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-19&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这种工作流运行在一个“while(true)”循环当中，每一次处理的数据是上一次的运行结果。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-20&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;接下来的分析可以归纳为一个简单的例子。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-21&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;假设你有一个工作流程需要12小时运行，因此，它每运行一次需要处理数据12小时。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-22&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;现在让我们假设需要做一些额外的计算工作，估计将在现有的工作流上增加两小时处理时间。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-23&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;问题来了。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-24&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;整个系统的运行增加的时间可能会远远多于两小时。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-25&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;它可能会增加10个小时，几百个小时，或者可能失去控制并且每一轮运行越来越慢。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-26&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-tm goog-gtc-from-tm-score-100&quot; dir=&quot;ltr&quot;&gt;为啥呢？&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-27&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;关键是你将系统需要&lt;strong&gt;12&lt;/strong&gt;小时处理的数据运行时间增加到了&lt;strong&gt;14&lt;/strong&gt;小时。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-28&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这意味着下一次运行的工作流程，将有&lt;strong&gt;14&lt;/strong&gt;小时的数据需要处理。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-29&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;由于下一个迭代有更多的数据，将需要更长的时间运行。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-30&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;这意味着下一次迭代会有&lt;strong&gt;更多&lt;/strong&gt;的数据，等等。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-31&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;要确定怎么让运行稳定，让我们做一些简单的数学。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-32&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;首先，让我们写了一个系统运行一次的公式：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-33&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;运行时间=系统开销+（单机处理1小时数据的运行时间）*（总数据量/单击处理1小时的数据量）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-34&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;系统开销是指任何&lt;em&gt;常数时间&lt;/em&gt;的消耗。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-35&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;例如，启动一个程序的开销。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-37&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;任何运行时间同数据量无关的开销将属于这个“系统开销”这个类别。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-38&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;“单击处理1小时数据的运行时间”指的是系统中的&lt;em&gt;动态处理数据时间&lt;/em&gt; 。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-39&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这是处理的实际数据量花费的时间，去掉了固定的系统时间开销。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-40&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;如果每个小时数据在系统中需要运行半小时，这个值为0.5。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-41&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;如果每个小时数据需要运行两小时，这个值为2。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;span id=&quot;more-135&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-42&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;为了简洁，让我们重写上面的公式中使用的变量：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span id=&quot;goog-gtc-unit-43&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T = O + P * H&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-44&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;要确定系统的稳定运行时间，我们需要找出系统运行时间和需要处理的数据量之间的关系。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-45&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;为了做到这一点，我们只需假设T = H：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span id=&quot;goog-gtc-unit-46&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T = O + P * T
&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-47&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T = O /（1 - P）&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-48&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这就是之前提到的公式。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-49&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;正如你所看到的，系统的运行时间同系统开销是&lt;em&gt;线性相关&lt;/em&gt;的。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-50&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;所以，如果你能减少25％的系统开销，你的系统运行时间也将减少25％。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-51&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;然而，系统运行时间同动态处理时间&amp;#8221;P&amp;#8221;是&lt;em&gt;非线性相关&lt;/em&gt;的。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-52&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这方面的一个直接体会是，随着机器数量的增加, 系统性能提升效果是不断缩小的。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-53&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;有了这个公式，我们可以回答所在本文开头提出的问题。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-54&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;让我们一个一个的解决他们：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;span id=&quot;goog-gtc-unit-55&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;当机器的处理能力加快一倍, 为什么整个系统运行的速度没有增加一倍?&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-56&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;机器加倍将减少你的“处理一个小时数据的时间”（P的50％）。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-57&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;2 3 整个系统的提升效果，完全依赖于增加机器前P的取值。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-58&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;让我们把增大机群大小前的系统运行时间称为“T1”，增加之后的称为“T2”。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-59&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;我们得到两个等式：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span id=&quot;goog-gtc-unit-60&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T1 = O /（1 - P）
&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-61&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T2 = O /（1 - P / 2）&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-62&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T2 / T1表示的就是提升的效率, 新系统运行效率比旧系统提升的比例。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-63&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;于是有了：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span id=&quot;goog-gtc-unit-64&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T2 / T1 =（1 - P）/（1 - P / 2）
&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-65&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T2 / T1 = 1 - P /（2 - P）&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-66&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;通过公式我们得到如下图，x轴表示P, y轴表示加速的比例&lt;sup class=&quot;footnote&quot;&gt;&lt;a id=&quot;fnref-6-4&quot; href=&quot;http://www.google.com/url?q=http%3A%2F%2Fnathanmarz.com%2Fblog%2Fhadoop-mathematics%2F%23fn-6-4&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNESdKtu0SRxIdSOCiSr4HlCkvjnIQ&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.google.com/url?q=http%3A%2F%2Fnathanmarz.com%2Fblog%2Fwp-content%2Fuploads%2F2009%2F12%2FScreen-shot-2009-12-27-at-5.06.54-PM1.png&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNFJnQG61fm3YrpGRX_10d7KBZ--RQ&quot;&gt;&lt;img class=&quot;alignnone size-full wp-image-65&quot; src=&quot;http://nathanmarz.com/blog/wp-content/uploads/2009/12/Screen-shot-2009-12-27-at-5.06.54-PM1.png&quot; alt=&quot;&quot; width=&quot;489&quot; height=&quot;299&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-67&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-mt&quot; dir=&quot;ltr&quot;&gt;该图说明了一切。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-68&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;如果您的P非常高，比如1小时数据需要需系统运行54分钟，那么机群加大一倍将导致新的运行时间为原运行时间的&lt;strong&gt;18%&lt;/strong&gt;, 效率提高了&lt;strong&gt;82％&lt;/strong&gt;！&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-69&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这是一个非常反直观的结果-我强烈建议读者仔细思考产生这样效果的原因。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-70&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;如果你以前的P不高（如1小时数据系统只需运行6分钟），那么机群加大一倍对运行时间的影响几乎没有-只有约6％左右。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-71&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这是有道理的，因为运行时占主导地位的是系统开销. 实际处理数据占总运行时间的比例非常小.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;span id=&quot;goog-gtc-unit-72&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;如果故障率增加10%,为什么整体的运行时间增加了300%?&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-73&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这个问题说明了&lt;strong&gt;系统稳定性&lt;/strong&gt;的重要性。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-74&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;在一个大的机器集群中，将会一直碰到各种机械故障，因此重要的是失败率峰值不会影响到系统核心任务的运行。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-75&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;对于这个问题的分析，看起来同上一个问题非常相似，但这个时候，我们在降低，而不是提高它的处理效率。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-76&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;10％的故障率意味着数据处理的时间增加了11%&lt;sup class=&quot;footnote&quot;&gt;&lt;a id=&quot;fnref-6-5&quot; href=&quot;http://www.google.com/url?q=http%3A%2F%2Fnathanmarz.com%2Fblog%2Fhadoop-mathematics%2F%23fn-6-5&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNGhYaD1YeLSckWZTFGC0k5F-OF5UA&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;。这意味着我们的“处理一个小时数据的时间” （P）将增加11％。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-77&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;和上一个问题一样，让我们把没有故障发生的运行时间称为T1, 而发生失败后运行时间称为T2：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span id=&quot;goog-gtc-unit-78&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T1 = O /（1 - P）
&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-79&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T2 = O /（1 - 1.11 * P）
&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-80&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;T2 / T1 =（1 - P）/（1 - 1.11 * P）&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-81&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;我们得到下图：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.google.com/url?q=http%3A%2F%2Fnathanmarz.com%2Fblog%2Fwp-content%2Fuploads%2F2009%2F12%2FScreen-shot-2009-12-27-at-5.34.41-PM.png&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNGHgLDxXM67rkkULLkQPD_eowheVw&quot;&gt;&lt;img class=&quot;alignnone size-full wp-image-74&quot; src=&quot;http://nathanmarz.com/blog/wp-content/uploads/2009/12/Screen-shot-2009-12-27-at-5.34.41-PM.png&quot; alt=&quot;&quot; width=&quot;465&quot; height=&quot;308&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-82&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;正如你所看到的，系统机群的规模越小, 故障率对运行时间的影响越剧烈。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-83&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;因此，让系统的P保持在低水平非常重要。&lt;/span&gt;&lt;/span&gt;&lt;sup class=&quot;footnote&quot;&gt;&lt;a id=&quot;fnref-6-6&quot; href=&quot;http://www.google.com/url?q=http%3A%2F%2Fnathanmarz.com%2Fblog%2Fhadoop-mathematics%2F%23fn-6-6&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNFCgb3yrVt0pGPgH5QJwZJJMSsQwA&quot;&gt;&lt;span id=&quot;goog-gtc-unit-85&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;6&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;h3&gt;&lt;span id=&quot;goog-gtc-unit-95&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;为了得到最优的性能和容错表现, 一个计算机群应该部署多少机器？&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span id=&quot;goog-gtc-unit-96&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;这是一个非常典型的成本效益分析实例。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-97&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;我们已经看到，通过增加机器机群的大小，提高系统效率的效果逐渐减小的，一旦P（“一小时数据的处理时间”）低于30分钟（0.5），增加机器获得性能提升将小于线性比例。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-98&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;&lt;sup class=&quot;footnote&quot;&gt;&lt;a id=&quot;fnref-6-8&quot; href=&quot;http://www.google.com/url?q=http%3A%2F%2Fnathanmarz.com%2Fblog%2Fhadoop-mathematics%2F%23fn-6-8&amp;amp;sa=D&amp;amp;sntz=1&amp;amp;usg=AFQjCNEugW1PrE4yB4M678syUUlXeg9cFQ&quot;&gt;8&lt;/a&gt;&lt;/sup&gt; 我们也看到保持P值在低水平是多重要，否则在故障率提升或者利用群集进行其他工作时可能会明显增加系统运行时间。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-99&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;因此，你需要为你的系统计算出公式中的数字，以确定最佳的机器数量。&lt;/span&gt;&lt;/span&gt;&lt;span id=&quot;goog-gtc-unit-100&quot; class=&quot;goog-gtc-unit&quot;&gt;&lt;span class=&quot;goog-gtc-translatable goog-gtc-from-human&quot; dir=&quot;ltr&quot;&gt;9 10&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/335041335/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/135&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041335/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041335/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://dajianghu.org/archives/135/feed</wfw:commentRss><description>原文地址: http://nathanmarz.com/blog/hadoop-mathematics/
我希望我在一年前就知道这些。现在，通过一些简单的数学我终于可以回答下面的问题：

当机器的处理能力加快一倍, 为什么整个系统运行的速度没有增加一倍?
如果故障率增加10%,为什么整体的运行时间增加了300%?
为了得到最优的性能和容错表现, 一个计算机群应该部署多少机器？

一个简单的数学公式可以巧妙的回答所有这些问题:
运行时间=系统开销/（1 - （1小时数据量的处理时间) ）
我们将在稍后证明这个等式。首先，让我们简要地讨论一下“Hadoop为基础的系统。(分布式系统)”1 Hadoop的一个常规应用是处理一个连续输入的数据流。这种工作流运行在一个“while(true)”循环当中，每一次处理的数据是上一次的运行结果。
接下来的分析可以归纳为一个简单的例子。假设你有一个工作流程需要12小时运行，因此，它每运行一次需要处理数据12小时。现在让我们假设需要做一些额外的计算工作，估计将在现有的工作流上增加两小时处理时间。问题来了。整个系统的运行增加的时间可能会远远多于两小时。它可能会增加10个小时，几百个小时，或者可能失去控制并且每一轮运行越来越慢。
为啥呢？
关键是你将系统需要12小时处理的数据运行时间增加到了14小时。这意味着下一次运行的工作流程，将有14小时的数据需要处理。由于下一个迭代有更多的数据，将需要更长的时间运行。这意味着下一次迭代会有更多的数据，等等。
要确定怎么让运行稳定，让我们做一些简单的数学。首先，让我们写了一个系统运行一次的公式：
运行时间=系统开销+（单机处理1小时数据的运行时间）*（总数据量/单击处理1小时的数据量）
系统开销是指任何常数时间的消耗。例如，启动一个程序的开销。任何运行时间同数据量无关的开销将属于这个“系统开销”这个类别。
“单击处理1小时数据的运行时间”指的是系统中的动态处理数据时间 。这是处理的实际数据量花费的时间，去掉了固定的系统时间开销。如果每个小时数据在系统中需要运行半小时，这个值为0.5。如果每个小时数据需要运行两小时，这个值为2。


为了简洁，让我们重写上面的公式中使用的变量：
T = O + P * H
要确定系统的稳定运行时间，我们需要找出系统运行时间和需要处理的数据量之间的关系。为了做到这一点，我们只需假设T = H：
T = O + P * T
T = O /（1 - P）
这就是之前提到的公式。正如你所看到的，系统的运行时间同系统开销是线性相关的。所以，如果你能减少25％的系统开销，你的系统运行时间也将减少25％。然而，系统运行时间同动态处理时间&amp;#8221;P&amp;#8221;是非线性相关的。这方面的一个直接体会是，随着机器数量的增加, 系统性能提升效果是不断缩小的。
有了这个公式，我们可以回答所在本文开头提出的问题。让我们一个一个的解决他们：
当机器的处理能力加快一倍, 为什么整个系统运行的速度没有增加一倍?
机器加倍将减少你的“处理一个小时数据的时间”（P的50％）。2 3 整个系统的提升效果，完全依赖于增加机器前P的取值。让我们把增大机群大小前的系统运行时间称为“T1”，增加之后的称为“T2”。我们得到两个等式：
T1 = O /（1 - P）
T2 = O /（1 - P / 2）
T2 / T1表示的就是提升的效率, 新系统运行效率比旧系统提升的比例。于是有了：
T2 / T1 =（1 - P）/（1 - P / [...]&lt;img src=&quot;http://www1.feedsky.com/t1/335041335/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/135&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041335/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041335/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><category>互联网</category><pubDate>Sun, 17 Jan 2010 23:32:28 +0800</pubDate><author>一陀浆糊</author><comments>http://dajianghu.org/archives/135#comments</comments><guid isPermaLink="false">http://dajianghu.org/?p=135</guid><dc:creator>一陀浆糊</dc:creator><fs:srclink>http://dajianghu.org/archives/135</fs:srclink><fs:srcfeed>http://dajianghu.org/feed</fs:srcfeed><fs:itemid>feedsky/dajianghu/~7587916/335041335/5696998</fs:itemid></item><item><title>Just for fun for 随机排列算法的一个证明</title><link>http://dajianghu.org/archives/114</link><content:encoded>&lt;p&gt;&lt;!--[if !mso]&gt;&lt;br /&gt;
&lt;mce:style&gt;&lt;!  v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} --&gt;&lt;/p&gt;
&lt;p&gt;对n个元素的数组，一个极简单有效的随机排列算法如下所示：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;for(int i = n-1; i &amp;gt; 0; i&amp;#8211;){&lt;br /&gt;
swap(i,rand()%(i+1));&lt;br /&gt;
}&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;这个算法初看起来并不自然，但其实是很简单的。直观地看，排列过程中，数组分为两部分：排列就绪部分（长度为n-i）和候选元素部分(长度为i)。每次从候选元素部分随机取一元素(rand()%(i+1))，放到排列就绪部分头部，将所占据位置上原来的元素扔进候选元素部分。注意到，候选元素部分的顺序是无关紧要的，因为一个元素无论处于什么位置，下一次被选到的概率都是1/候选部分长度。因此为了算法复杂度低和简单起见，每次都将被占据位置的元素与被选到的元素交换（这两者有可能是同一元素）。简单地说，它的思想就是从一堆元素中随机选出一个来，再从剩下的元素里随机选择，直到选完为止。&lt;/p&gt;
&lt;p&gt;严格证明的话，用数学归纳法是简单的，对n进行归纳即可。但好久不做数学题，头脑快生锈了，因此尝试一下复杂一些的证明，证明思想是对原位置i的元素进行跟踪。&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-114&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;定义一个函数&lt;img class=&quot;alignnone size-full wp-image-115&quot; title=&quot;1&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/1.gif&quot; alt=&quot;1&quot; width=&quot;60&quot; height=&quot;21&quot; /&gt;：候选部分长度为n时，当前数组第i个位置的元素在算法结束后处于第k个位置的概率。&lt;/p&gt;
&lt;p&gt;元素i第一次参与交换（即swap()的参数中出现了i）后，处于位置j(j=1..n)的概率有多大呢？有两种情况，第一种情况是i&amp;lt;=j，这时发生的事情就是第n-j+1次交换时，元素i与元素j发生了交换，如下图所示：&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;alignnone size-full wp-image-116&quot; title=&quot;2&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/2.jpg&quot; alt=&quot;2&quot; width=&quot;208&quot; height=&quot;89&quot; /&gt;&lt;/p&gt;
&lt;p&gt;这个发生的概率是：P(元素i与元素n没有交换)*P(元素i与元素n-1没有交换)*&amp;#8230;*P(元素i与元素j+1没有交换)*P(元素i与元素j交换) ＝ &lt;img class=&quot;alignnone size-full wp-image-118&quot; title=&quot;3&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/3.gif&quot; alt=&quot;3&quot; width=&quot;165&quot; height=&quot;44&quot; /&gt;&lt;/p&gt;
&lt;p&gt;第二种情况，j&amp;lt;i，这时发生的事情就是第n-i+1次交换时，元素i与元素j发生了交换，如下图所示：&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;alignnone size-full wp-image-119&quot; title=&quot;3&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/3.jpg&quot; alt=&quot;3&quot; width=&quot;218&quot; height=&quot;93&quot; /&gt;&lt;/p&gt;
&lt;p&gt;这个发生的概率是：P(元素i与元素n没有交换)*P(元素i与元素n-1没有交换)*&amp;#8230;*P(元素i与元素i+1没有交换)*P(元素i与元素j交换)= &lt;img class=&quot;alignnone size-full wp-image-120&quot; title=&quot;4&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/4.gif&quot; alt=&quot;4&quot; width=&quot;157&quot; height=&quot;41&quot; /&gt;&lt;/p&gt;
&lt;p&gt;因此在两种情况下，元素i在第一次参与交换时，被换到位置j(j=1..n)的概率都是1/n。&lt;/p&gt;
&lt;p&gt;因此有：   &lt;img class=&quot;alignnone size-full wp-image-122&quot; title=&quot;6&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/6.gif&quot; alt=&quot;6&quot; width=&quot;170&quot; height=&quot;46&quot; /&gt;，m为i第一次参与交换后候选数组大小，m=1..n-1。&lt;/p&gt;
&lt;p&gt;即元素i最终处于位置k的概率，等于第一次参与交换后处于位置j(j=1..n)，之后再被换到位置k的概率。&lt;/p&gt;
&lt;p&gt;由于 &lt;img class=&quot;alignnone size-full wp-image-123&quot; title=&quot;7&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/7.gif&quot; alt=&quot;7&quot; width=&quot;108&quot; height=&quot;46&quot; /&gt;，（1≤m≤n，1≤k≤n），即数组内总有一个元素j，算法结束后处于位置k，因此&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;alignnone size-full wp-image-124&quot; title=&quot;8&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/8.gif&quot; alt=&quot;8&quot; width=&quot;308&quot; height=&quot;46&quot; /&gt;&lt;/p&gt;
&lt;p&gt;即位置i的元素最终处于任意位置k的概率都是 &lt;img class=&quot;alignnone size-full wp-image-117&quot; title=&quot;9&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/9.gif&quot; alt=&quot;9&quot; width=&quot;16&quot; height=&quot;41&quot; /&gt;，得证。&lt;/p&gt;
&lt;p&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-size: 10.5pt; font-family: &amp;quot;Times New Roman&amp;quot;;&quot; lang=&quot;EN-US&quot;&gt;&lt;span style=&quot;position: relative; top: 15pt;&quot;&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype  id=&quot;_x0000_t75&quot; coordsize=&quot;21600,21600&quot; o:spt=&quot;75&quot; o:preferrelative=&quot;t&quot;  path=&quot;m@4@5l@4@11@9@11@9@5xe&quot; filled=&quot;f&quot; stroked=&quot;f&quot;&gt; &lt;v:stroke joinstyle=&quot;miter&quot; /&gt; &lt;v:formulas&gt; &lt;v:f eqn=&quot;if lineDrawn pixelLineWidth 0&quot; /&gt; &lt;v:f eqn=&quot;sum @0 1 0&quot; /&gt; &lt;v:f eqn=&quot;sum 0 0 @1&quot; /&gt; &lt;v:f eqn=&quot;prod @2 1 2&quot; /&gt; &lt;v:f eqn=&quot;prod @3 21600 pixelWidth&quot; /&gt; &lt;v:f eqn=&quot;prod @3 21600 pixelHeight&quot; /&gt; &lt;v:f eqn=&quot;sum @0 0 1&quot; /&gt; &lt;v:f eqn=&quot;prod @6 1 2&quot; /&gt; &lt;v:f eqn=&quot;prod @7 21600 pixelWidth&quot; /&gt; &lt;v:f eqn=&quot;sum @8 21600 0&quot; /&gt; &lt;v:f eqn=&quot;prod @7 21600 pixelHeight&quot; /&gt; &lt;v:f eqn=&quot;sum @10 21600 0&quot; /&gt; &lt;/v:formulas&gt; &lt;v:path o:extrusionok=&quot;f&quot; gradientshapeok=&quot;t&quot; o:connecttype=&quot;rect&quot; /&gt; &lt;o:lock v:ext=&quot;edit&quot; aspectratio=&quot;t&quot; /&gt; &lt;/v:shapetype&gt;&lt;v:shape id=&quot;_x0000_i1025&quot; type=&quot;#_x0000_t75&quot; style='width:75pt;  height:35.25pt' o:ole=&quot;&quot;&gt; &lt;v:imagedata src=&quot;file:///C:\DOCUME~1\JLFDDC~1.JL-\LOCALS~1\Temp\msohtml1\01\clip_image001.wmz&quot; mce_src=&quot;file:///C:\DOCUME~1\JLFDDC~1.JL-\LOCALS~1\Temp\msohtml1\01\clip_image001.wmz&quot;   o:title=&quot;&quot; /&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt; &lt;o:OLEObject Type=&quot;Embed&quot; ProgID=&quot;Equation.3&quot; ShapeID=&quot;_x0000_i1025&quot;   DrawAspect=&quot;Content&quot; ObjectID=&quot;_1309434932&quot;&gt; &lt;/o:OLEObject&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/335041336/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/114&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041336/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041336/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://dajianghu.org/archives/114/feed</wfw:commentRss><description>对n个元素的数组，一个极简单有效的随机排列算法如下所示：
for(int i = n-1; i &amp;#62; 0; i&amp;#8211;){
swap(i,rand()%(i+1));
}
这个算法初看起来并不自然，但其实是很简单的。直观地看，排列过程中，数组分为两部分：排列就绪部分（长度为n-i）和候选元素部分(长度为i)。每次从候选元素部分随机取一元素(rand()%(i+1))，放到排列就绪部分头部，将所占据位置上原来的元素扔进候选元素部分。注意到，候选元素部分的顺序是无关紧要的，因为一个元素无论处于什么位置，下一次被选到的概率都是1/候选部分长度。因此为了算法复杂度低和简单起见，每次都将被占据位置的元素与被选到的元素交换（这两者有可能是同一元素）。简单地说，它的思想就是从一堆元素中随机选出一个来，再从剩下的元素里随机选择，直到选完为止。
严格证明的话，用数学归纳法是简单的，对n进行归纳即可。但好久不做数学题，头脑快生锈了，因此尝试一下复杂一些的证明，证明思想是对原位置i的元素进行跟踪。

定义一个函数：候选部分长度为n时，当前数组第i个位置的元素在算法结束后处于第k个位置的概率。
元素i第一次参与交换（即swap()的参数中出现了i）后，处于位置j(j=1..n)的概率有多大呢？有两种情况，第一种情况是i&amp;#60;=j，这时发生的事情就是第n-j+1次交换时，元素i与元素j发生了交换，如下图所示：

这个发生的概率是：P(元素i与元素n没有交换)*P(元素i与元素n-1没有交换)*&amp;#8230;*P(元素i与元素j+1没有交换)*P(元素i与元素j交换) ＝ 
第二种情况，j&amp;#60;i，这时发生的事情就是第n-i+1次交换时，元素i与元素j发生了交换，如下图所示：

这个发生的概率是：P(元素i与元素n没有交换)*P(元素i与元素n-1没有交换)*&amp;#8230;*P(元素i与元素i+1没有交换)*P(元素i与元素j交换)= 
因此在两种情况下，元素i在第一次参与交换时，被换到位置j(j=1..n)的概率都是1/n。
因此有：   ，m为i第一次参与交换后候选数组大小，m=1..n-1。
即元素i最终处于位置k的概率，等于第一次参与交换后处于位置j(j=1..n)，之后再被换到位置k的概率。
由于 ，（1≤m≤n，1≤k≤n），即数组内总有一个元素j，算法结束后处于位置k，因此

即位置i的元素最终处于任意位置k的概率都是 ，得证。&lt;img src=&quot;http://www1.feedsky.com/t1/335041336/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/114&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041336/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041336/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><category>学习</category><pubDate>Sat, 18 Jul 2009 19:11:21 +0800</pubDate><author>linecong</author><comments>http://dajianghu.org/archives/114#comments</comments><guid isPermaLink="false">http://dajianghu.org/?p=114</guid><dc:creator>linecong</dc:creator><fs:srclink>http://dajianghu.org/archives/114</fs:srclink><fs:srcfeed>http://dajianghu.org/feed</fs:srcfeed><fs:itemid>feedsky/dajianghu/~7587916/335041336/5696998</fs:itemid></item><item><title>“左”&quot;右”政治</title><link>http://dajianghu.org/archives/80</link><content:encoded>&lt;h2&gt;一. 先来说说什么是&amp;#8221;左&amp;#8221;和&amp;#8221;右&amp;#8221;&lt;/h2&gt;
&lt;h2&gt;1. 左翼(left-wing)和右翼(right-wing)的历史&lt;/h2&gt;
&lt;p&gt;以左右来划分政治派别, 起源于法国大革命. 在那个叫路易XX为国王的波旁王朝最后掌权的年代, 法国议会的右边坐着保皇党人, 而左边则是激进改革派. 从那时候起, 为政治派别首先划分开了阵营, 便于扎堆和排队, 区分敌友.&lt;/p&gt;
&lt;h2&gt;2. 传统意义上的&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;二元区分&lt;/h2&gt;
&lt;p&gt;先来看看, 左右翼阵营划分之初, 两边的区分&lt;/p&gt;
&lt;table border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;左翼&lt;/td&gt;
&lt;td&gt;右翼&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;更多的经济干预&lt;/td&gt;
&lt;td&gt;更多的经济自由&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;以消除不平等为目的&lt;/td&gt;
&lt;td&gt;承认不平等的存在&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;绝对意义上的平等&lt;/td&gt;
&lt;td&gt;获得机会的平等&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;自由主义&lt;/td&gt;
&lt;td&gt;保守主义&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;无神论政府&lt;/td&gt;
&lt;td&gt;宗教政府&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;法律支配文化&lt;/td&gt;
&lt;td&gt;文化支配法律&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;从这个最基本的分歧上, 后续产生了分居两边的各种主义和体系, 社会主义/共产主义/资本主义, 大陆法系/英美法系等等&lt;/p&gt;
&lt;p&gt;但&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;的划分和阵营不是一个绝对的划分, 而是相对的概念&lt;/p&gt;
&lt;p&gt;当法国大革命轮到&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;罗伯斯比尔和雅各宾派上台的时候, 自由主义的左派在砍了国王的脑袋以后, 也开始为了维护自己的政权疯狂的砍其他异见者的脑袋.这一点上讲, &amp;#8220;左&amp;#8221;和&amp;#8221;右&amp;#8221;都可能成为保守派, 只要在他们掌权以后; 同时也都可能是改革派, 那是他们在野的时候.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;&lt;span id=&quot;more-80&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;3. 多维的&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;将斯大林, 毛泽东和甘地都放在左派的阵营里面, 我们还是感到了他们之间巨大的差别, 尤其是斯大林和甘地.就像今天的中国一样, 从历史和政体上他都像一个左翼政府, 而且有着中国几千年中央集权大政府的传统, 但却拥有偏右翼的市场经济. 那么中国应该算左右哪个阵营呢?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;&lt;a href=&quot;http://www.politicalcompass.org&quot;&gt;www.politicalcompass.org&lt;/a&gt;给了我们一个更多维度的解释方法&amp;#8212;&amp;#8211;将经济和社会各个维度独立开来.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;&lt;img class=&quot;alignnone size-full wp-image-82&quot; title=&quot;axeswithnames&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/axeswithnames.gif&quot; alt=&quot;axeswithnames&quot; width=&quot;500&quot; height=&quot;500&quot; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;x轴代表经济上的左右, 一边是经济上的集体主义, 一边是经济上的自由主义; y轴代表社会制度上的左右, 一边是专制, 一边自由意识. 那么斯大林和甘地就可以区分开了, 斯大林是专制左派(国家利益大于个人); 而圣雄甘地是一个自由左派(强调每个个体的利益), 虽然他们的经济目标都类似, 但手段上还是有差别. 一个是用强制手段, 来吧都来搞集体主义, 不然搞你; 一个是自愿参与. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;至于毛时代的中国, 毫无疑问的应该在第一象限; 而邓之后的中国相信已经落在了第二象限.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;4. 做为政治工具的&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;&lt;/span&gt;&lt;/h2&gt;
&lt;h2&gt;&lt;img class=&quot;alignnone size-full wp-image-88&quot; title=&quot;leftright&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/leftright.gif&quot; alt=&quot;leftright&quot; width=&quot;400&quot; height=&quot;21&quot; /&gt;&lt;/h2&gt;
&lt;p&gt;在一个传统意义上单一维度的左右,  给玩政治的搞出了很多便利条件.  比如, 只要比我右统统可以称作右派, 这样划分阵营就容易多了. 从中国近代史上, 先是靠打击左派搞定瞿秋白, 王明, 博古, 之后就是漫长的日右派的时间. 尤其是在一个专制政权下, 是不允许有不同意见的, 那么站错队就是死罪.&lt;/p&gt;
&lt;p&gt;在一个左翼政权下, 给&amp;#8221;左&amp;#8221;做了很多功课, 在洗脑教育的熏陶下, 就算搞不清楚到底是什么东西, 也留下了&amp;#8221;左&amp;#8221;是积极的倾向, 而&amp;#8221;右&amp;#8221;是腐朽落后的. 其实不才觉得&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;没有绝对的优劣, 只是不同选择罢了.&lt;/p&gt;
&lt;p&gt;举个极端的例子就是纳粹, 纳粹经常被宣传为“极右”理念, 其实在他身上也有社会主义的影子. 纳粹全称叫“国家社会主义工人党”, 他们自己也承认自己是走社会主义路子的, 除了这个没什么概念的名字外, 纳粹的政治主张也有很多&amp;#8221;左&amp;#8221;的主张, 比如典型的对富人加税, 纳粹不是在全国范围加税（左派喜欢争辩说那是为了给战争机器提供资金），而是在4年时间里，对大约1/4的收入群体加税。 难怪当初帮助纳粹掌握权力的工业家Fritz Thyssen在1940年说道：“很快德国就会和布尔什维克的苏联没有区别了，不按照‘计划’做的企业家会被指责为背叛德国人民，然后被枪决。”&lt;/p&gt;
&lt;p&gt;&amp;#8220;左&amp;#8221;&quot;右&amp;#8221;的概念相对直线而言, 更像是一个圆圈, 极左和极右会在远端回合, 或者说更像一个“&lt;a href=&quot;http://baike.baidu.com/view/307178.htm&quot; target=&quot;_blank&quot;&gt;魔比斯环&lt;/a&gt;”. 就像现在距离天堂最近的北欧诸国, 虽然是传统的资本主义阵营, 奉行的也是自由市场经济, 甚至还保留了君主制. 但从社会角度看, 却实现了左翼政权的理想&amp;#8212;-消除不平等和共同富裕.&lt;/p&gt;
&lt;p&gt;从法国大革命走出来, &amp;#8220;左&amp;#8221;和&amp;#8221;右&amp;#8221;已经摆脱了所谓进步与落后, 之前我们对&amp;#8221;左&amp;#8221;或&amp;#8221;右&amp;#8221;过多的美化和偏见都可以暂抛一旁.&lt;/p&gt;
&lt;h2&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;5. 集权和民主&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;经济上左右的选择也是个to be or not be的问题, 也许永远也不会有正确和错误的结论, 同时也许也没有纯粹的&amp;#8221;左&amp;#8221;和&amp;#8221;右&amp;#8221;. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;在集权和民主和争论也是同样, 中国是个有几千年中央集权历史的国家, 而往往盛世王朝都是集权大一统的时代, 中国人对于集体主义的效率和优势有着天生的认同和感知, 在此就不再赘述了.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;西方在经历了中世纪宗教极权(算是极端的权利集中了)的黑暗时代后, 从宗教改革到文艺复兴, 却给了自由民主一方一些活生生的例子.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;美国的独立史, 可以认为是这种思潮的爆发. 从汤玛斯.佩恩的&lt;a href=&quot;http://en.wikipedia.org/wiki/Common_Sense_(pamphlet)&quot; target=&quot;_blank&quot;&gt;&amp;#8220;常识&amp;#8221;&lt;/a&gt;开始, 到富兰克林起草的独立宣言, 都是其中的经典. 用天赋人权取代了君权神受.人作为个体的权利被正式搬上了法典. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;&amp;#8220;&lt;/span&gt;我们认为下述真理是不言而喻的：人人生而平等，造物主赋予他们若干不可让与的权利，其中包括生存权、自由权和追求幸福的权利。为了保障这些权利，人们才在他们中间建立政府，而政府的正当权利，则是经被统治者同意授予的。任何形式的政府一旦对这些目标的实现起破坏作用时，人民便有权予以更换或废除，以建立一 个新的政府。&amp;#8230;&amp;#8230;.. 过去的一切经验都说明，任何苦难，只要尚能忍受，人类还是情愿忍受，也不想为申冤而废除他们久已习惯了的政府形式。然而，当始终追求同一目标的一系列滥用 职权和强取豪夺的行为表明政府企图把人民至于专制暴政之下时，人民就有权也有义务去推翻这样的政府，并为其未来的安全提供新的保障。&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;&amp;#8220;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;集权和民主之间的优劣, 由于浆糊本人有比较明确的立场,  也许会有过分美化和丑化的嫌疑, 在此就不再继续深入的展开了.&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;h1&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;二. 中国的&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;故事&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;中国的近现代史上, 由于掌权历史的是一个左翼政权, 基本上是挺左反右的基调. 当然遇上派系斗争, 挣权夺利的时候, 左也是可以拿出来的说事. 作为一个基本不懂历史的宅男, 在洗脑教育中, 基本没留下什么有用的东西. 对于没有亲历的历史, &lt;span style=&quot;FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Georgia; mso-hansi-font-family: Georgia; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA&quot;&gt;只能从后来捡回来的点滴人和事里面妄图窥探当时的片段&lt;/span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;1. 延安整风&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;1937年，一个瘦瘦弱弱的文学青年奔赴延安的时候怎么都不会想到等待自己的会是一场灾难，他只是像当时大多数才华出众的大学生一样怀着对圣地美好的梦想，因为不满国民党当局而奔赴心中的理想， 他叫&lt;a href=&quot;http://baike.baidu.com/view/142397.htm&quot; target=&quot;_blank&quot;&gt;王实味&lt;/a&gt;.  &amp;#8220;我们青年的使命就是要用我们的力去捣毁一切黑暗的渊窟，用我们的热血去浇灭一切罪恶的魔火，拯救砧危的祖国，改造龌龊的社会，乃是我们应有的唯一的目标与责任。&amp;#8221;在延安，他专门从事翻译马克思、恩格斯、列宁原著的工作。四年间单独或与人合作共译出近二百万字的理论书稿。算得上正统的党内理论家吧。&lt;/p&gt;
&lt;p&gt;1942年3月在写下了一组杂文《野百合花》. 在这组杂文里面批评等级制度，批评革命圣地缺乏爱与温暖，批评圣地载歌载舞的升平气象，多少热血青年奔赴延安就是为了寻求”美丽与温暖”，所以对”丑恶与冷淡”忍不住要”发牢骚”。由此开始了一场针对王实味暴风骤雨的批判，很快，由于党的高层介入，这场批判也变成了整个延安的文艺整风运动，王实味的被迫不停的自我检查，承认自己 “有浓厚的虚无主义倾向”，”小资产阶级病态的忧郁性”和”极端顽强的自以为是”，并说自己”神经确实有些异状”。像瞿秋白，陈独秀一样，这也是敏感而又天真的人，即使在山雨欲来的批判大会中，他还执着于他的人性论，说”斯大林人性不可爱”，苏联清党时”斯大林不知造成了多少罪恶”？”斯大林的性情太粗暴了”。&lt;/p&gt;
&lt;p&gt;1946年春，社会部部长康生批准处死王实味，没有起诉、没有审判、没有上诉和裁定。当时国民党胡宗南部已经围剿过来，为了节省子弹，王实味被从后砍头，尸体丢在了一口枯井之中。&lt;/p&gt;
&lt;h2&gt;2. 57年反右&lt;/h2&gt;
&lt;p&gt;杨显惠有本书叫 《&lt;a href=&quot;http://www.douban.com/subject/1064223/&quot; target=&quot;_blank&quot;&gt;夹边沟记事&lt;/a&gt;》. 讲的就是这时候右派的故事. 夹边沟，甘肃酒泉境内沙漠边缘一个昔日的劳改农场，多年来，默默无闻，不为人知。一九五七年十月至一九六Ｏ年底，这里关押了甘肃省近三千名右派。在天寒地冻的沙漠中，他们与世隔绝，终日劳作，并且经历了罕见的大饥荒，几乎吃尽了荒漠上能吃的和不能吃的所有东西，最后被活活饿死——三年时间里，饿死的右派数以千记。&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Georgia','serif'; mso-fareast-font-family: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt&quot; lang=&quot;EN-US&quot;&gt;&amp;#8220;&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Georgia; mso-hansi-font-family: Georgia&quot;&gt;没有房子住，没有粮食吃，没有水喝，只有光秃秃的一片旱滩。一千多名右派就像原始人类一样，穴居在山洪冲出的两道山水沟里的地窝子和窑洞里。&amp;#8230;&amp;#8230; 死亡高峰不可避免地到来，每天都有数十人死去。由于右派死亡太多，而且渐渐地连掩埋死者的右派都很难找到了，他们都再也没有足够的力气了，因此，对死者的掩埋越来越草率，大都是用肮脏的破被子裹一裹，拉到附近的沙包里，简单地用沙子盖一下了事。当时的右派们形象地称之为&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Georgia','serif'; mso-fareast-font-family: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt&quot; lang=&quot;EN-US&quot;&gt;“&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Georgia; mso-hansi-font-family: Georgia&quot;&gt;钻沙包&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Georgia','serif'; mso-fareast-font-family: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt&quot; lang=&quot;EN-US&quot;&gt;”&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Georgia; mso-hansi-font-family: Georgia&quot;&gt;。&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Georgia','serif'; mso-fareast-font-family: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt&quot;&gt; &lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Georgia; mso-hansi-font-family: Georgia&quot;&gt;一九六Ｏ年的冬天，右派们真正进入了生命的绝境，也就是在这时候，夹边沟事件中最为惊世骇俗的一幕出现了：活人吃死人&lt;/span&gt;&lt;span style=&quot;FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Georgia','serif'; mso-fareast-font-family: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt&quot; lang=&quot;EN-US&quot;&gt;&amp;#8230;&amp;#8230;&amp;#8221;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;3. 文化大革命&lt;/h2&gt;
&lt;p&gt;一位天津作家冯骥才先生有本书《&lt;a href=&quot;http://www.douban.com/subject/1212199/&quot; target=&quot;_blank&quot;&gt;一百个人的十年&lt;/a&gt;》 , 用&amp;#8221;口述照实记录，不做任何演染和虚构&amp;#8221;的方式, 还原了一百个普通中国人在”文革”中心灵历程的真实记录，显现那场旷古未闻的劫难的真相. 这本书里，记录了很多荒谬又残酷的事实。14岁被打成特务；因为父亲成为右派而与他断绝关系；8岁成为死刑陪绑者；阖家寻死而亲手杀死父亲；变着法子整人的种种……&lt;/p&gt;
&lt;p&gt;&amp;#8220;有的右派熬不住就自杀, 找不到自杀的家伙，便在吃饭时把筷子插进鼻孔，把头用力往桌上一磕, 筷子就穿进脑子, 还有的跳粪坑活活憋死 &amp;#8230;&amp;#8230;.&amp;#8221;&lt;/p&gt;
&lt;h2&gt;4. &amp;#8230;&amp;#8230;&amp;#8230;&lt;/h2&gt;
&lt;h1&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;三. 量化的&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;1. 政治罗盘:&lt;a href=&quot;http://www.politicalcompass.org/test&quot; target=&quot;_blank&quot;&gt;http://www.politicalcompass.org/test&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;英文的政治倾向测试.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span onmouseover=&quot;_tipon(this)&quot; onmouseout=&quot;_tipoff()&quot;&gt;2. &lt;/span&gt;北大未名版: &lt;a rel=&quot;nofollow&quot; href=&quot;http://blog.farmostwood.net/politics_bdwm&quot; target=&quot;_blank&quot;&gt;http://blog.farmostwood.net/politics_bdwm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;中文版的测试, 题目设置有了&amp;#8221;中国特色&amp;#8221;&lt;/p&gt;
&lt;p&gt;感兴趣的可以试一试&lt;/p&gt;
&lt;p&gt;援引北大未名版作者的一句话作为结尾&lt;/p&gt;
&lt;h3&gt;&amp;#8220;我个人并不以为左和右之间有最好和最坏之分，在我心中最坏的时代便是没有人敢于选择自己的倾向的时代&amp;#8221;&lt;/h3&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/335041337/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/80&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041337/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041337/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://dajianghu.org/archives/80/feed</wfw:commentRss><description>一. 先来说说什么是&amp;#8221;左&amp;#8221;和&amp;#8221;右&amp;#8221;
1. 左翼(left-wing)和右翼(right-wing)的历史
以左右来划分政治派别, 起源于法国大革命. 在那个叫路易XX为国王的波旁王朝最后掌权的年代, 法国议会的右边坐着保皇党人, 而左边则是激进改革派. 从那时候起, 为政治派别首先划分开了阵营, 便于扎堆和排队, 区分敌友.
2. 传统意义上的&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;二元区分
先来看看, 左右翼阵营划分之初, 两边的区分



左翼
右翼


更多的经济干预
更多的经济自由


以消除不平等为目的
承认不平等的存在


绝对意义上的平等
获得机会的平等


自由主义
保守主义


无神论政府
宗教政府


法律支配文化
文化支配法律



从这个最基本的分歧上, 后续产生了分居两边的各种主义和体系, 社会主义/共产主义/资本主义, 大陆法系/英美法系等等
但&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;的划分和阵营不是一个绝对的划分, 而是相对的概念
当法国大革命轮到罗伯斯比尔和雅各宾派上台的时候, 自由主义的左派在砍了国王的脑袋以后, 也开始为了维护自己的政权疯狂的砍其他异见者的脑袋.这一点上讲, &amp;#8220;左&amp;#8221;和&amp;#8221;右&amp;#8221;都可能成为保守派, 只要在他们掌权以后; 同时也都可能是改革派, 那是他们在野的时候.


 
3. 多维的&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;
将斯大林, 毛泽东和甘地都放在左派的阵营里面, 我们还是感到了他们之间巨大的差别, 尤其是斯大林和甘地.就像今天的中国一样, 从历史和政体上他都像一个左翼政府, 而且有着中国几千年中央集权大政府的传统, 但却拥有偏右翼的市场经济. 那么中国应该算左右哪个阵营呢?
www.politicalcompass.org给了我们一个更多维度的解释方法&amp;#8212;&amp;#8211;将经济和社会各个维度独立开来.

x轴代表经济上的左右, 一边是经济上的集体主义, 一边是经济上的自由主义; y轴代表社会制度上的左右, 一边是专制, 一边自由意识. 那么斯大林和甘地就可以区分开了, 斯大林是专制左派(国家利益大于个人); 而圣雄甘地是一个自由左派(强调每个个体的利益), 虽然他们的经济目标都类似, 但手段上还是有差别. 一个是用强制手段, 来吧都来搞集体主义, 不然搞你; 一个是自愿参与. 
至于毛时代的中国, 毫无疑问的应该在第一象限; 而邓之后的中国相信已经落在了第二象限.
4. 做为政治工具的&amp;#8221;左&amp;#8221;&quot;右&amp;#8221;

在一个传统意义上单一维度的左右,  给玩政治的搞出了很多便利条件.  比如, 只要比我右统统可以称作右派, 这样划分阵营就容易多了. 从中国近代史上, 先是靠打击左派搞定瞿秋白, [...]&lt;img src=&quot;http://www1.feedsky.com/t1/335041337/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/80&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041337/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041337/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><category>互联网</category><pubDate>Sat, 11 Jul 2009 00:20:45 +0800</pubDate><author>一陀浆糊</author><comments>http://dajianghu.org/archives/80#comments</comments><guid isPermaLink="false">http://dajianghu.org/?p=80</guid><dc:creator>一陀浆糊</dc:creator><fs:srclink>http://dajianghu.org/archives/80</fs:srclink><fs:srcfeed>http://dajianghu.org/feed</fs:srcfeed><fs:itemid>feedsky/dajianghu/~7587916/335041337/5696998</fs:itemid></item><item><title>倾国又倾城</title><link>http://dajianghu.org/archives/93</link><content:encoded>&lt;p&gt;倾国倾城的典故出自汉武帝&lt;br /&gt;
他在四五十岁平定内忧外患并且泰山封禅三年之后面对滔滔江山写了那首《秋风辞》&lt;br /&gt;
&lt;span style=&quot;color: #0070c0;&quot;&gt;秋风起兮白云飞，草木黄落兮雁南归。&lt;br /&gt;
兰有秀兮菊有芳，怀佳人兮不能忘。&lt;br /&gt;
泛楼船兮济汾河，横中流兮扬素波。&lt;br /&gt;
萧鼓鸣兮发棹歌，欢乐极兮哀情多。&lt;br /&gt;
少壮几时兮奈老何！&lt;/span&gt;&lt;br /&gt;
一切忧愁源于对时光流逝的恐惧&lt;br /&gt;
而男人对时光流逝的恐惧感总是比女人要晚一二十年才出现并且表现点有所差别&lt;br /&gt;
女人的恐惧源于时光的蹉跎青春一转眼就不见，却还有那么多事来不及完成那么多欲望来不及满足那么多幸福来不及体验&lt;br /&gt;
而男人的恐惧源于在过去的几十年间，埋头苦干外拼事业内辅家庭，把自己的生活带上蓝图之后，一下几十年过去了，却不知道自己真的想干什么&lt;br /&gt;
刘彻也是在这个时候心生感慨&lt;br /&gt;
不过这个是题外话&lt;br /&gt;
&lt;span id=&quot;more-93&quot;&gt;&lt;/span&gt;&lt;br /&gt;
也就是在这个时候，平阳公主向刘彻推荐了李夫人&lt;br /&gt;
李夫人是宫中乐师李延年的妹妹&lt;br /&gt;
李延年这样称赞他妹妹&lt;br /&gt;
&lt;span style=&quot;color: #1f497d;&quot;&gt;北方有佳人，绝世而独立；&lt;br /&gt;
一顾倾人城，再顾倾人国。&lt;/span&gt;&lt;br /&gt;
于是刘彻大喜，李夫人入宫后，宠爱有加&lt;br /&gt;
倾国倾城这个词便出自于此&lt;br /&gt;
但此为其一，这个倾国倾城的故事却有后续&lt;br /&gt;
李夫人进宫后不多年便因病去世&lt;br /&gt;
患病期间，汉武帝去探访她，李夫人不见&lt;br /&gt;
旁人问原因，李夫人道：&lt;br /&gt;
夫以色事人者，色衰则爱驰，爱驰则恩绝；很有人赞李夫人理智，因为她的理智，保有了刘彻对她漫长的思念&lt;br /&gt;
在其死后，仍然招术士企图还魂想见她, 但在我看来李夫人这样做自然不全出于一个女人企图在男人心中保有美好形象的理智&lt;br /&gt;
而是因为彼时其兄长李延年，李广利事于朝廷，李广利更是奉旨多次带兵出征匈奴，最后被封诸侯&lt;br /&gt;
整个家族功绩和在朝廷的地位均因刘彻对李夫人的感情而生，所以李夫人自然避忌良多&lt;br /&gt;
整个典故最有意思的便是结局李夫人的那段话&lt;/p&gt;
&lt;p&gt;好像整一巴掌拍在男人们的脸上&lt;br /&gt;
而这些个男人们，上下五千年，劣根性却是从未改变&lt;br /&gt;
关于汉武帝，还有很多有意思的绯闻故事&lt;br /&gt;
比如那个金屋藏娇后又被废的皇后陈阿娇&lt;br /&gt;
传说汉武帝本身非常好色，入土做鬼后还经常半夜飘到宫中，猥亵宫女&lt;br /&gt;
放到现在来看，这种绝对属于道德问题，再早个二十多年，要被联防队手电筒照照拉去教育的，再早个三十多年，就是政治问题，严重点是要被枪毙的&lt;br /&gt;
但也是这个好色的汉武帝，即便纳了倾国又倾城的李夫人，却同时又成功地在治国上秉承文景之治，通西域拓疆土，创造了西汉最为鼎盛的大一统时期&lt;br /&gt;
所谓自古红颜多祸水，终究让人觉得是男人在自觉不成气候的时候一句无力的开脱与辩驳罢了&lt;/p&gt;
&lt;p&gt;换个角度来说&lt;br /&gt;
为什么我们评定历届古人时可以把他的私生活和政绩分开看&lt;br /&gt;
对活生生的生活在身边的或者只是生活在同一个时代的旁人，却有那么多道德标准呢？&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/335041338/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/93&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041338/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041338/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://dajianghu.org/archives/93/feed</wfw:commentRss><description>倾国倾城的典故出自汉武帝
他在四五十岁平定内忧外患并且泰山封禅三年之后面对滔滔江山写了那首《秋风辞》
秋风起兮白云飞，草木黄落兮雁南归。
兰有秀兮菊有芳，怀佳人兮不能忘。
泛楼船兮济汾河，横中流兮扬素波。
萧鼓鸣兮发棹歌，欢乐极兮哀情多。
少壮几时兮奈老何！
一切忧愁源于对时光流逝的恐惧
而男人对时光流逝的恐惧感总是比女人要晚一二十年才出现并且表现点有所差别
女人的恐惧源于时光的蹉跎青春一转眼就不见，却还有那么多事来不及完成那么多欲望来不及满足那么多幸福来不及体验
而男人的恐惧源于在过去的几十年间，埋头苦干外拼事业内辅家庭，把自己的生活带上蓝图之后，一下几十年过去了，却不知道自己真的想干什么
刘彻也是在这个时候心生感慨
不过这个是题外话

也就是在这个时候，平阳公主向刘彻推荐了李夫人
李夫人是宫中乐师李延年的妹妹
李延年这样称赞他妹妹
北方有佳人，绝世而独立；
一顾倾人城，再顾倾人国。
于是刘彻大喜，李夫人入宫后，宠爱有加
倾国倾城这个词便出自于此
但此为其一，这个倾国倾城的故事却有后续
李夫人进宫后不多年便因病去世
患病期间，汉武帝去探访她，李夫人不见
旁人问原因，李夫人道：
夫以色事人者，色衰则爱驰，爱驰则恩绝；很有人赞李夫人理智，因为她的理智，保有了刘彻对她漫长的思念
在其死后，仍然招术士企图还魂想见她, 但在我看来李夫人这样做自然不全出于一个女人企图在男人心中保有美好形象的理智
而是因为彼时其兄长李延年，李广利事于朝廷，李广利更是奉旨多次带兵出征匈奴，最后被封诸侯
整个家族功绩和在朝廷的地位均因刘彻对李夫人的感情而生，所以李夫人自然避忌良多
整个典故最有意思的便是结局李夫人的那段话
好像整一巴掌拍在男人们的脸上
而这些个男人们，上下五千年，劣根性却是从未改变
关于汉武帝，还有很多有意思的绯闻故事
比如那个金屋藏娇后又被废的皇后陈阿娇
传说汉武帝本身非常好色，入土做鬼后还经常半夜飘到宫中，猥亵宫女
放到现在来看，这种绝对属于道德问题，再早个二十多年，要被联防队手电筒照照拉去教育的，再早个三十多年，就是政治问题，严重点是要被枪毙的
但也是这个好色的汉武帝，即便纳了倾国又倾城的李夫人，却同时又成功地在治国上秉承文景之治，通西域拓疆土，创造了西汉最为鼎盛的大一统时期
所谓自古红颜多祸水，终究让人觉得是男人在自觉不成气候的时候一句无力的开脱与辩驳罢了
换个角度来说
为什么我们评定历届古人时可以把他的私生活和政绩分开看
对活生生的生活在身边的或者只是生活在同一个时代的旁人，却有那么多道德标准呢？&lt;img src=&quot;http://www1.feedsky.com/t1/335041338/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/93&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041338/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041338/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><category>两性</category><category>随便</category><pubDate>Fri, 10 Jul 2009 21:58:31 +0800</pubDate><author>刚果</author><comments>http://dajianghu.org/archives/93#comments</comments><guid isPermaLink="false">http://dajianghu.org/?p=93</guid><dc:creator>刚果</dc:creator><fs:srclink>http://dajianghu.org/archives/93</fs:srclink><fs:srcfeed>http://dajianghu.org/feed</fs:srcfeed><fs:itemid>feedsky/dajianghu/~7587916/335041338/5696998</fs:itemid></item><item><title>旷世孤独——淇淇七年之祭</title><link>http://dajianghu.org/archives/89</link><content:encoded>&lt;p&gt;7年前的7月14日，一条名为“淇淇”的白鳍豚在武汉白鳍豚馆度过了22个春秋之后，在这一天孤独的离开了世界。&lt;/p&gt;
&lt;p&gt;淇淇是人类见过的最后一条活着的白鳍豚。虽曾于2004年发现过白鳍豚的尸体，然而之后数次大规模的监测活动中却再也没能找到它们的身影。两年前的8月8日，这种我们从小熟知的“长江女神”，“水中大熊猫”，终于被宣告灭绝。&lt;/p&gt;
&lt;p&gt;在白鳍豚馆里的22年中，淇淇虽然有过短暂的伴侣，绝大部分时间都是在孤独中度过的。设想一下，如果你是世间幸存的最后一个人，对于你这意味着什 么？是不是旷世的孤独、绝望与无助？这样不幸的事情正发生在它的身上。再也找不到谁与它结伴而游，喜欢结群的它只能在池中独自游弋；任凭它引吭高唱，这世 界上已没有谁能理解它的声音。&lt;span id=&quot;more-89&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;就在80年代，长江上还有几百头白鳍豚，偶尔还能见到它们在水中翻腾的身影。黄金水道的开发，给人来带来的是滚滚黄金，给他们带来的却是水闸阻断洄游路线，水体污染，以及撞击螺旋桨的事故。赖以生存的母亲河，终于成了它们最后的墓地。&lt;/p&gt;
&lt;p&gt;我一直不愿相信白鳍豚的灭绝，我宁愿相信它们像尼斯湖水怪一样，看透了人类的本性，躲在一个神秘的地方，从此与人类不再相见。&lt;/p&gt;
&lt;p&gt;下面的图片是一位网友在黄州江滩拍得。江水的冲刷，竟形成了酷似白鳍豚的造型。淇淇，这是你的化身么？在这7年之祭，我谨以此文为你招魂。&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;aligncenter size-medium wp-image-90&quot; title=&quot;post-3-1199842709&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/07/post-3-1199842709-300x225.jpg&quot; alt=&quot;post-3-1199842709&quot; width=&quot;300&quot; height=&quot;225&quot; /&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/335041339/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/89&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041339/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041339/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://dajianghu.org/archives/89/feed</wfw:commentRss><description>7年前的7月14日，一条名为“淇淇”的白鳍豚在武汉白鳍豚馆度过了22个春秋之后，在这一天孤独的离开了世界。
淇淇是人类见过的最后一条活着的白鳍豚。虽曾于2004年发现过白鳍豚的尸体，然而之后数次大规模的监测活动中却再也没能找到它们的身影。两年前的8月8日，这种我们从小熟知的“长江女神”，“水中大熊猫”，终于被宣告灭绝。
在白鳍豚馆里的22年中，淇淇虽然有过短暂的伴侣，绝大部分时间都是在孤独中度过的。设想一下，如果你是世间幸存的最后一个人，对于你这意味着什 么？是不是旷世的孤独、绝望与无助？这样不幸的事情正发生在它的身上。再也找不到谁与它结伴而游，喜欢结群的它只能在池中独自游弋；任凭它引吭高唱，这世 界上已没有谁能理解它的声音。
就在80年代，长江上还有几百头白鳍豚，偶尔还能见到它们在水中翻腾的身影。黄金水道的开发，给人来带来的是滚滚黄金，给他们带来的却是水闸阻断洄游路线，水体污染，以及撞击螺旋桨的事故。赖以生存的母亲河，终于成了它们最后的墓地。
我一直不愿相信白鳍豚的灭绝，我宁愿相信它们像尼斯湖水怪一样，看透了人类的本性，躲在一个神秘的地方，从此与人类不再相见。
下面的图片是一位网友在黄州江滩拍得。江水的冲刷，竟形成了酷似白鳍豚的造型。淇淇，这是你的化身么？在这7年之祭，我谨以此文为你招魂。&lt;img src=&quot;http://www1.feedsky.com/t1/335041339/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/89&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041339/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041339/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><category>互联网</category><category>生命</category><pubDate>Tue, 07 Jul 2009 11:17:27 +0800</pubDate><author>saltycookie</author><comments>http://dajianghu.org/archives/89#comments</comments><guid isPermaLink="false">http://dajianghu.org/?p=89</guid><dc:creator>saltycookie</dc:creator><fs:srclink>http://dajianghu.org/archives/89</fs:srclink><fs:srcfeed>http://dajianghu.org/feed</fs:srcfeed><fs:itemid>feedsky/dajianghu/~7587916/335041339/5696998</fs:itemid></item><item><title>温故而知新</title><link>http://dajianghu.org/archives/77</link><content:encoded>&lt;p&gt;假如你有1000万要办一个网站。下面两种方案：&lt;/p&gt;
&lt;p&gt;1，用800万买性能高的服务器，200万雇专业能力一般的技术人员；&lt;/p&gt;
&lt;p&gt;2，用200万买性能一般的服务器，800万雇专业能力优秀的技术人员。&lt;/p&gt;
&lt;p&gt;哪种更划算呢？&lt;/p&gt;
&lt;p&gt;之前想了几次这个问题，但一直没得到一个简便的答案。后来突然想到，这个事情在算法教科书里经常提到。大意就是，假如你的程序使用的算法的复杂度是高于线性的，那么你买一个性能提高了N倍 的机器，你的程序单位时间内处理的数据量并不会提高N倍。&lt;/p&gt;
&lt;p&gt;那么机器与人的区别就是，更贵的机器为你的程序带来的性能提升是线性的；而一个优秀的技术人员，通过设计时间复杂度更低的算法，则可能帮你将一个性能较差的程序的性能以平方、立方甚至指数级别提升。如果这样想的话，第2种方案更为划算。&lt;/p&gt;
&lt;p&gt;这是一个很开放的问题。这里只是从性能这个角度去考虑，而且纯粹是理论上的。实际中需要考虑的因素更多。大家有何想法呢？&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/335041340/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/77&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041340/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041340/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://dajianghu.org/archives/77/feed</wfw:commentRss><description>假如你有1000万要办一个网站。下面两种方案：
1，用800万买性能高的服务器，200万雇专业能力一般的技术人员；
2，用200万买性能一般的服务器，800万雇专业能力优秀的技术人员。
哪种更划算呢？
之前想了几次这个问题，但一直没得到一个简便的答案。后来突然想到，这个事情在算法教科书里经常提到。大意就是，假如你的程序使用的算法的复杂度是高于线性的，那么你买一个性能提高了N倍 的机器，你的程序单位时间内处理的数据量并不会提高N倍。
那么机器与人的区别就是，更贵的机器为你的程序带来的性能提升是线性的；而一个优秀的技术人员，通过设计时间复杂度更低的算法，则可能帮你将一个性能较差的程序的性能以平方、立方甚至指数级别提升。如果这样想的话，第2种方案更为划算。
这是一个很开放的问题。这里只是从性能这个角度去考虑，而且纯粹是理论上的。实际中需要考虑的因素更多。大家有何想法呢？&lt;img src=&quot;http://www1.feedsky.com/t1/335041340/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/77&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041340/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041340/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><category>互联网</category><pubDate>Fri, 26 Jun 2009 18:30:45 +0800</pubDate><author>linecong</author><comments>http://dajianghu.org/archives/77#comments</comments><guid isPermaLink="false">http://dajianghu.org/?p=77</guid><dc:creator>linecong</dc:creator><fs:srclink>http://dajianghu.org/archives/77</fs:srclink><fs:srcfeed>http://dajianghu.org/feed</fs:srcfeed><fs:itemid>feedsky/dajianghu/~7587916/335041340/5696998</fs:itemid></item><item><title>A naive social model</title><link>http://dajianghu.org/archives/23</link><content:encoded>&lt;p&gt;作为一个纯真的少年，心目中的社会模型首先是这样的：&lt;/p&gt;
&lt;p&gt;最低级的社会，是森林那样的社会，不需要任何组织和上层建筑，唯一的法则是“弱肉强食”。但是随着社会的进一步发展，弱肉强食的法则显然行不通了，比如我们总不能让相对较弱的妇女儿童随便被“弱肉强食”掉，或者有些人比较有远见、有些人较有智谋，但身体相对较弱，总不能让这些对群体有用的人也被“弱肉强食”掉。因此需要一个统治阶层，形成一套社会组织，来行使更有利于群体发展的社会法则。从这位纯真少年的朴素社会模型来看，统治天然是服务性质的。&lt;/p&gt;
&lt;p&gt;但是随着纯真少年年龄的增长和阅历的加深，他变成一个理工男，并且看到了中国社会的很多现象都不符合这个朴素模型，甚至对这个模型进行修正也行不通。好奇的理工男于是慢慢形成了一套新的社会模型，来帮助自己理解新观察到的现象。就像物理模型一样，它摒弃了大量的繁琐的细节（有可能是重要的细节），只留下简单的一个社会过程。&lt;/p&gt;
&lt;p&gt;一个模型通常需要定义一些极端简化的实体，这里也不例外。首先，有必要对好人和坏人来做一下定义。好人和坏人并不是两个截然分开的集合，而是数轴上的两个端点。极端的好人倾向于善待社会群体中的其他人，做事更倾向于责任、信仰，而不是受个人利益倾使；坏人则相反，更倾向于通过侵犯他人的利益来最大化自己的利益，做事更倾向于受个人利益趋使。&lt;/p&gt;
&lt;p&gt;刚才提到的朴素社会模型，盲点之一在于统治阶层的形成过程。这个形成过程我们希望它是有序的、被有利于群体的法则支配的。但是悖论在于，统治阶层形成之前，新的法则尚不存在，社会基本上仍被“弱肉强身”法则支配，因此这个统治阶层形成的过程就大有问题。在这个新的社会模型中，统治阶层形成的过程中发生了一件重要的事情，与“劣币驱逐良币类似”，那就是“坏人驱逐好人”。&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-23&quot;&gt;&lt;/span&gt;坏人为什么能够驱逐好人？去除大量的具体细节，我认为主要是基于这样一个论证：因为坏人受个人利益驱使，不择手段，他完全可以假装是一个人好人。也就是说，在坏人的本质上可以虚拟出一个好人！这样，坏人的能力至少等同于好人，即好人能做的事情，坏人都可以做。而坏人能做的事情，好人则不一定能做。为什么好人不能模拟一个坏人？为了回答这一点，需要联系到《人工智能－一种现代方法》中提到的概念。这本书中提到有两种智能体，一种是goal-based的智能体，一种是utility-based的智能体。前者是给它设定了目标，它采取任何可能的手段，只要达成目标就完事；后者还是有一定的目标的，只不过在目标之外还有很多的限制，比如我要到达某地旅行，不光到达那里就完事了，还要尽量在旅途中保持舒适、安全、费用尽量少，等等。也就是说，如果单以是否达到目标来衡量的话，utility-based的智能体是有一定弱势的，因为它的限制比较多。我这里提到的好人也是这样，由于他要考虑到群体中其他人的利益、他的责任和信仰，为了达到“成为统治者”的目标，他的限制是比坏人要多的。这样，坏人的能力是好人的超集。&lt;/p&gt;
&lt;p&gt;在统治阶层的形成过程中，通过“坏人驱逐好人”的过程，好人被轻松淘汰掉了。如果统治阶层是一个金字塔，在智慧、体力等自然能力相同的情况下，越“坏”的人越容易爬到高层。&lt;/p&gt;
&lt;p&gt;在坏人形成统治阶层头目的时候，这个统治阶层将是什么样的性质？显然它已经大大偏离了上面的朴素模型的“服务性质”。想象一下，我是一个坏人，我的目的是获得最大化的个人利益，那么我将使整个社会变成一个“羊圈”。牧羊人的目的是从羊圈身上获取到羊毛和羊肉，而统治者的愿望是通过社会这个大羊圈内的人们的劳动，获得尽可能多的财富、美女，等等。那么统治者理想的社会是什么，是稳定的、顺从的。为实现这样的社会统治者将使用很多手段，一个重要的手段是思想文化方面的。这种思想方法具有这些特征：首先，思想文化必须足够单一，不能思想太活跃了影响稳定；其二，这个思想文化不能包含足够强的逻辑和真理，最好有点模棱两可，能够使民众足够愚钝和顺从；其三，这种文化可以影响民众中较有才华和能力的人，将他们吸纳到统治阶层中，以巩固统治。“儒家”文化、以及后来经过统治阶级优化的马克思主义、辩证论等，恰 好很符合这些特征。&lt;/p&gt;
&lt;p&gt;随着时间的推移，接下来又会发生什么呢？注意到，社会主流文化主要会造成两方面的问题。首先，由于思想文化本身含有愚民性质，它对人们思维和创造力的危害是巨大的，在那些高度需要思维能力和创造力的领域，如科学领域，难以开花结果；其次，在统治阶层，表面上仍宣扬主流的思想文化，背地里却会形成一种叫做“厚黑学”的潜规则，人与人之间勾心斗角，导致统治阶层中厌倦了这一套的人、或者勾心斗角中的loser，开始追求另一种文化，即超脱避世的老庄哲学。&lt;/p&gt;
&lt;p&gt;由于“厚黑学”，以及统治阶层本身的利益驱逐性质，统治阶层的人们像蛀虫一样腐蚀着统治阶层本身，导致随着时间的积累，统治阶层自身成为一滩烂泥。本来，统治者将民众圈养起来，让人们相对稳定和安全，对社会是有一定好处的；但随着统治阶层本身烂掉，连这种羊圈性质的稳定和安全也逐渐无力维持了。中国两三百年的朝代，一般是前半个世纪处于上升期；而后逐渐被自身的统治者腐蚀，积弊越来越来深厚，开始了长达一两百年的腐蚀和苟延残喘的过程，伴随着对百姓越来越严厉的搜刮，以填补腐蚀造成的空洞；最后半个世纪积弊爆发，陷入混乱，开始新一波的“群雄逐鹿”。按这个分析，百姓的生活，也就这个朝代的前半个世纪还相对不错，后来则越来越残酷了。&lt;/p&gt;
&lt;p&gt;如何打破这个可怕的循环，直至形成朴素理想中的社会，西方的经验告诉了我们很多，我这里就不用阐述了。但令人深思的是为什么西方社会可以形成足够良性的社会，而中国社会却总是陷入恶性循环呢？我想关键仍是从无序的社会形成有序的社会这个过程，只要这个过程足够良性，从这个过程中获得权力的人是真诚地想要形成一个理想中的社会，而不是为了达成私人利益，那么如何组织这样的社会，则是可以逐渐优化的技术细节了；否则即使有人打着自由民主的旗号，背地里仍可以通过修改关键的参数和规则来达到自身利益最大化的目的。一旦这个有序的良性社会形成，以后的社会都在这个框架内运转和自我修正，就更不用担心什么了。这是很难找到答案的问题，但从宗教信仰上也许可以找到一些说法，西方普遍具有宗教信仰，人们相信自己做任何事情，都有个上帝看在眼里，导致有序社会形成过程中，“坏人假装好人”这个过程较难实现，因为在上帝面前无法伪装。另外，西方的宗教信仰是独立于世俗社会，与统治者无关的；而中国社会即使有宗教信仰，也是在一定程度上受统治者影响，为统治阶层服务的。&lt;/p&gt;
&lt;p&gt;那为什么西方有信仰，中国社会又没有呢？这个问题太难回答了，我一个理工男，满足于自己构造出来的粗糙模型，能够解释心中的疑惑就行了。至于为什么一定要自己琢磨出来，学术大师们没有研究过吗？主要是考虑到，中国社会，“普天之下，莫非王土”，导致社会中没有什么能绝对独立于统治者的影响，学术也不例外。&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/335041341/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/23&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041341/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041341/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://dajianghu.org/archives/23/feed</wfw:commentRss><description>作为一个纯真的少年，心目中的社会模型首先是这样的：
最低级的社会，是森林那样的社会，不需要任何组织和上层建筑，唯一的法则是“弱肉强食”。但是随着社会的进一步发展，弱肉强食的法则显然行不通了，比如我们总不能让相对较弱的妇女儿童随便被“弱肉强食”掉，或者有些人比较有远见、有些人较有智谋，但身体相对较弱，总不能让这些对群体有用的人也被“弱肉强食”掉。因此需要一个统治阶层，形成一套社会组织，来行使更有利于群体发展的社会法则。从这位纯真少年的朴素社会模型来看，统治天然是服务性质的。
但是随着纯真少年年龄的增长和阅历的加深，他变成一个理工男，并且看到了中国社会的很多现象都不符合这个朴素模型，甚至对这个模型进行修正也行不通。好奇的理工男于是慢慢形成了一套新的社会模型，来帮助自己理解新观察到的现象。就像物理模型一样，它摒弃了大量的繁琐的细节（有可能是重要的细节），只留下简单的一个社会过程。
一个模型通常需要定义一些极端简化的实体，这里也不例外。首先，有必要对好人和坏人来做一下定义。好人和坏人并不是两个截然分开的集合，而是数轴上的两个端点。极端的好人倾向于善待社会群体中的其他人，做事更倾向于责任、信仰，而不是受个人利益倾使；坏人则相反，更倾向于通过侵犯他人的利益来最大化自己的利益，做事更倾向于受个人利益趋使。
刚才提到的朴素社会模型，盲点之一在于统治阶层的形成过程。这个形成过程我们希望它是有序的、被有利于群体的法则支配的。但是悖论在于，统治阶层形成之前，新的法则尚不存在，社会基本上仍被“弱肉强身”法则支配，因此这个统治阶层形成的过程就大有问题。在这个新的社会模型中，统治阶层形成的过程中发生了一件重要的事情，与“劣币驱逐良币类似”，那就是“坏人驱逐好人”。
坏人为什么能够驱逐好人？去除大量的具体细节，我认为主要是基于这样一个论证：因为坏人受个人利益驱使，不择手段，他完全可以假装是一个人好人。也就是说，在坏人的本质上可以虚拟出一个好人！这样，坏人的能力至少等同于好人，即好人能做的事情，坏人都可以做。而坏人能做的事情，好人则不一定能做。为什么好人不能模拟一个坏人？为了回答这一点，需要联系到《人工智能－一种现代方法》中提到的概念。这本书中提到有两种智能体，一种是goal-based的智能体，一种是utility-based的智能体。前者是给它设定了目标，它采取任何可能的手段，只要达成目标就完事；后者还是有一定的目标的，只不过在目标之外还有很多的限制，比如我要到达某地旅行，不光到达那里就完事了，还要尽量在旅途中保持舒适、安全、费用尽量少，等等。也就是说，如果单以是否达到目标来衡量的话，utility-based的智能体是有一定弱势的，因为它的限制比较多。我这里提到的好人也是这样，由于他要考虑到群体中其他人的利益、他的责任和信仰，为了达到“成为统治者”的目标，他的限制是比坏人要多的。这样，坏人的能力是好人的超集。
在统治阶层的形成过程中，通过“坏人驱逐好人”的过程，好人被轻松淘汰掉了。如果统治阶层是一个金字塔，在智慧、体力等自然能力相同的情况下，越“坏”的人越容易爬到高层。
在坏人形成统治阶层头目的时候，这个统治阶层将是什么样的性质？显然它已经大大偏离了上面的朴素模型的“服务性质”。想象一下，我是一个坏人，我的目的是获得最大化的个人利益，那么我将使整个社会变成一个“羊圈”。牧羊人的目的是从羊圈身上获取到羊毛和羊肉，而统治者的愿望是通过社会这个大羊圈内的人们的劳动，获得尽可能多的财富、美女，等等。那么统治者理想的社会是什么，是稳定的、顺从的。为实现这样的社会统治者将使用很多手段，一个重要的手段是思想文化方面的。这种思想方法具有这些特征：首先，思想文化必须足够单一，不能思想太活跃了影响稳定；其二，这个思想文化不能包含足够强的逻辑和真理，最好有点模棱两可，能够使民众足够愚钝和顺从；其三，这种文化可以影响民众中较有才华和能力的人，将他们吸纳到统治阶层中，以巩固统治。“儒家”文化、以及后来经过统治阶级优化的马克思主义、辩证论等，恰 好很符合这些特征。
随着时间的推移，接下来又会发生什么呢？注意到，社会主流文化主要会造成两方面的问题。首先，由于思想文化本身含有愚民性质，它对人们思维和创造力的危害是巨大的，在那些高度需要思维能力和创造力的领域，如科学领域，难以开花结果；其次，在统治阶层，表面上仍宣扬主流的思想文化，背地里却会形成一种叫做“厚黑学”的潜规则，人与人之间勾心斗角，导致统治阶层中厌倦了这一套的人、或者勾心斗角中的loser，开始追求另一种文化，即超脱避世的老庄哲学。
由于“厚黑学”，以及统治阶层本身的利益驱逐性质，统治阶层的人们像蛀虫一样腐蚀着统治阶层本身，导致随着时间的积累，统治阶层自身成为一滩烂泥。本来，统治者将民众圈养起来，让人们相对稳定和安全，对社会是有一定好处的；但随着统治阶层本身烂掉，连这种羊圈性质的稳定和安全也逐渐无力维持了。中国两三百年的朝代，一般是前半个世纪处于上升期；而后逐渐被自身的统治者腐蚀，积弊越来越来深厚，开始了长达一两百年的腐蚀和苟延残喘的过程，伴随着对百姓越来越严厉的搜刮，以填补腐蚀造成的空洞；最后半个世纪积弊爆发，陷入混乱，开始新一波的“群雄逐鹿”。按这个分析，百姓的生活，也就这个朝代的前半个世纪还相对不错，后来则越来越残酷了。
如何打破这个可怕的循环，直至形成朴素理想中的社会，西方的经验告诉了我们很多，我这里就不用阐述了。但令人深思的是为什么西方社会可以形成足够良性的社会，而中国社会却总是陷入恶性循环呢？我想关键仍是从无序的社会形成有序的社会这个过程，只要这个过程足够良性，从这个过程中获得权力的人是真诚地想要形成一个理想中的社会，而不是为了达成私人利益，那么如何组织这样的社会，则是可以逐渐优化的技术细节了；否则即使有人打着自由民主的旗号，背地里仍可以通过修改关键的参数和规则来达到自身利益最大化的目的。一旦这个有序的良性社会形成，以后的社会都在这个框架内运转和自我修正，就更不用担心什么了。这是很难找到答案的问题，但从宗教信仰上也许可以找到一些说法，西方普遍具有宗教信仰，人们相信自己做任何事情，都有个上帝看在眼里，导致有序社会形成过程中，“坏人假装好人”这个过程较难实现，因为在上帝面前无法伪装。另外，西方的宗教信仰是独立于世俗社会，与统治者无关的；而中国社会即使有宗教信仰，也是在一定程度上受统治者影响，为统治阶层服务的。
那为什么西方有信仰，中国社会又没有呢？这个问题太难回答了，我一个理工男，满足于自己构造出来的粗糙模型，能够解释心中的疑惑就行了。至于为什么一定要自己琢磨出来，学术大师们没有研究过吗？主要是考虑到，中国社会，“普天之下，莫非王土”，导致社会中没有什么能绝对独立于统治者的影响，学术也不例外。&lt;img src=&quot;http://www1.feedsky.com/t1/335041341/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/23&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041341/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041341/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><category>草泥马</category><pubDate>Sun, 21 Jun 2009 12:27:31 +0800</pubDate><author>linecong</author><comments>http://dajianghu.org/archives/23#comments</comments><guid isPermaLink="false">http://dajianghu.org/?p=23</guid><dc:creator>linecong</dc:creator><fs:srclink>http://dajianghu.org/archives/23</fs:srclink><fs:srcfeed>http://dajianghu.org/feed</fs:srcfeed><fs:itemid>feedsky/dajianghu/~7587916/335041341/5696998</fs:itemid></item><item><title>信息过载和meme</title><link>http://dajianghu.org/archives/45</link><content:encoded>&lt;p&gt;互联网从信息饥渴到信息过载,  几乎是瞬间完成的. web 2.0的普及更是带来了一个信息爆炸的时代.&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;size-full wp-image-49 alignnone&quot; title=&quot;web1_0-vs-web2_0&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/06/web1_0-vs-web2_0.png&quot; alt=&quot;web1_0-vs-web2_0&quot; width=&quot;307&quot; height=&quot;307&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;对于海量数据的网络, 人们有哪些需求?&lt;/h3&gt;
&lt;p&gt;一种是&amp;#8221;找&amp;#8221;, 用户知道自己想要什么, 就像从杂物间里面找硬币一样. 另一种是&amp;#8221;听&amp;#8221;, 我不知道我要什么, 你来告诉我这里有什么好玩的东西, 也许我会感些兴趣.&lt;/p&gt;
&lt;p&gt;十几年前, 有种叫搜索引擎的东西被造出来替人们去做第一件事情.但对于第二件事情,  却很难有个聪明的机器去替我们做, 因为机器还没智能到可以在没有任何人类提示的情况下, 从一堆一堆垃圾里面找到精华.&lt;/p&gt;
&lt;p&gt;这里面唯一值得一提的就是新闻聚合,  把新闻网站的内容聚出焦点来.  这是一个好的开始, 但还不够.如果我怀着一颗好奇的心, 那么我该去&amp;#8221;听&amp;#8221;谁的呢? 网络时代之前的做法被沿用了下来.&lt;/p&gt;
&lt;p&gt;1) 相信专业: 媒体编辑的职业就是干这活的, 天天看, 天天选. 他先替你一层一层选一遍, 你跟着他混就行了.这招准确率还行, 覆盖率不够. 同时严重依赖编辑的水平和操守, 最可怕的是遇到新闻联播型的媒体.&lt;/p&gt;
&lt;p&gt;2) 相信大众: 别人都说好的, 咱也别错过. 这个依赖于群体智慧的整体水平.&lt;/p&gt;
&lt;p&gt;3) 相信自己: 把所有东西看一遍, 自己来筛选精华.  这个方法好, 但似乎代价太大了&amp;#8230;&amp;#8230;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-45&quot;&gt;&lt;/span&gt;先把发现信息的难度撇开不谈,光是每天访问 solidot, engadget, 煎蛋, 草根, 牛博, yeeyan, 1510, keso, 一言谈, 小众软件&amp;#8230;&amp;#8230;&amp;#8230;&amp;#8230;..已经让人筋疲力尽了,更不要说web 2.0发展之后, 在发布信息几乎0成本的条件下, 变的更长和更扁平的信息源长尾了.&lt;/p&gt;
&lt;p&gt;信息源头现在已经不是问题, 获取信息的成本成了瓶颈.技术的创新, 首先从第3)点上开始帮助人们解决问题.&lt;/p&gt;
&lt;p&gt;rss和阅读器的产生, 从信息源被动等待访问, 变成了信息源主动推送. 对于获取方而言, 寻址和访问的成本被节省下来.个体可以关注的范围被扩大, 但很快, 又淹没在新的信息流当中.现实是订阅量越来越大, 同时未读的东西也越来越多.这一点上讲, rss阅读器没能帮助人们在对付信息过载上走多远.&lt;/p&gt;
&lt;h3&gt;这时候就需要提一下&lt;a href=&quot;http://baike.baidu.com/view/1806903.htm&quot; target=&quot;_blank&quot;&gt;meme理论&lt;/a&gt;.&lt;/h3&gt;
&lt;p&gt;meme是相对于遗传中的gene(基因)提出的.类似生物繁衍的本质在基因的传递, meme是信息传播中的因子.基因是通过遗传的形式传播, 而meme是通过模仿复制.&lt;/p&gt;
&lt;p&gt;举个例子来说,  当一个人听到或读到某个好的想法后，他把这个想法传给他的朋友，接着他的朋友又把这个想法传递给其他的人，这个过程就是模仿，通过模仿，想法从一个人的脑中传到另一个人的脑中，并不断地被复制传递。&lt;/p&gt;
&lt;p&gt;meme自身可能并不是完善的, 在传递的过程中, 也存在着变异和选择.如人们在转述一个事件时，或许会添加一些细节，或许会删减一些内容; 有些歌曲比较容易记忆，并能很快传播，有些歌曲则很少被传唱.&lt;/p&gt;
&lt;p&gt;这样来看, meme和基因一样, 也是一个自然选择的过程. 优质的meme会得到更广泛的传播, 传播的过程也会使留下来的meme自身得到完善.&lt;/p&gt;
&lt;p&gt;在网络环境中, 我们姑且称其中的meme为&lt;a href=&quot;http://en.wikipedia.org/wiki/Internet_meme&quot; target=&quot;_blank&quot;&gt;网络meme&lt;/a&gt;(internet meme).email, blog, sns网站, im给网络meme一个迅速传播, 选择的过程.&lt;/p&gt;
&lt;p&gt;前面提到的新闻聚合服务, 其实就是利用新闻报道和转载的过程, 寻找优质meme的应用.信息筛选的过程实际变为记录meme自然选择的过程, 获得传播量优势的meme自然就是优质的.这就给机器的介入提供了机会, 机器可能无法理解meme的内容, 但利用人对人的传播过程, 机器就可以理解他的价值, 前提是机器捕捉到传播的过程.&lt;/p&gt;
&lt;p&gt;就以&lt;a href=&quot;http://www.google.cn/search?source=igchina&amp;amp;hl=zh-CN&amp;amp;rlz=1G1GGLQ_ZH-CNCN329&amp;amp;q=%E6%97%A0%E5%A4%84%E4%B8%8D%E5%9C%A8%E7%9A%84%E4%BA%94%E6%AF%9B%E5%85%9A&amp;amp;btnG=Google+%E6%90%9C%E7%B4%A2&amp;amp;aq=f&amp;amp;oq=&quot; target=&quot;_blank&quot;&gt;&amp;#8220;无处不在的五毛党&amp;#8221;&lt;/a&gt;为例&lt;/p&gt;
&lt;p&gt;这篇blog在可能吧上发出后, 先后通过微博客, rss reader等方式进入了社会化网络, 当然还有可能有im, email, 只不过这些信息我们无法follow到.&lt;/p&gt;
&lt;p&gt;微博客上的转发, rss reader上的分享, 这是第一级的传播.&lt;/p&gt;
&lt;p&gt;进而鲜果的推荐, 玩聚的热点, 豆瓣的9点这类meme挖掘服务也捕捉到了, 这是第二级传播&lt;/p&gt;
&lt;p&gt;之后出现的大量转载和复制, 又使他有了第三级传播&lt;/p&gt;
&lt;p&gt;直到被我们可爱的网络监管部门发现, 勒令删除. 可见传播的范围之广.目前在搜索引擎上仍可以搜到大量的复制品, 这些复制品仍将继续传播下去.&lt;/p&gt;
&lt;p&gt;而且值得庆幸的是, 这整个传播过程除了&amp;#8221;有关部门&amp;#8221;的部分, 都是可以被机器捕捉下来的. 尤其是有先天技术优势的搜索引擎.&lt;/p&gt;
&lt;p&gt;对于信息推荐上, 有理由相信是有第4中方法的, 就是&lt;/p&gt;
&lt;p&gt;4) 由机器代替人去选择.&lt;/p&gt;
&lt;p&gt;白社会, 淘江湖, 做一个重复的类似twitter的服务, 只不过继续延长信息源的长尾, 增加信息过载的程度罢了.像豆瓣9点, 玩聚sr, 甚至更广泛意义上的信息聚合才是更值得期待的互联网应用.&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/335041342/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/45&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041342/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041342/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://dajianghu.org/archives/45/feed</wfw:commentRss><description>互联网从信息饥渴到信息过载,  几乎是瞬间完成的. web 2.0的普及更是带来了一个信息爆炸的时代.

对于海量数据的网络, 人们有哪些需求?
一种是&amp;#8221;找&amp;#8221;, 用户知道自己想要什么, 就像从杂物间里面找硬币一样. 另一种是&amp;#8221;听&amp;#8221;, 我不知道我要什么, 你来告诉我这里有什么好玩的东西, 也许我会感些兴趣.
十几年前, 有种叫搜索引擎的东西被造出来替人们去做第一件事情.但对于第二件事情,  却很难有个聪明的机器去替我们做, 因为机器还没智能到可以在没有任何人类提示的情况下, 从一堆一堆垃圾里面找到精华.
这里面唯一值得一提的就是新闻聚合,  把新闻网站的内容聚出焦点来.  这是一个好的开始, 但还不够.如果我怀着一颗好奇的心, 那么我该去&amp;#8221;听&amp;#8221;谁的呢? 网络时代之前的做法被沿用了下来.
1) 相信专业: 媒体编辑的职业就是干这活的, 天天看, 天天选. 他先替你一层一层选一遍, 你跟着他混就行了.这招准确率还行, 覆盖率不够. 同时严重依赖编辑的水平和操守, 最可怕的是遇到新闻联播型的媒体.
2) 相信大众: 别人都说好的, 咱也别错过. 这个依赖于群体智慧的整体水平.
3) 相信自己: 把所有东西看一遍, 自己来筛选精华.  这个方法好, 但似乎代价太大了&amp;#8230;&amp;#8230;
先把发现信息的难度撇开不谈,光是每天访问 solidot, engadget, 煎蛋, 草根, 牛博, yeeyan, 1510, keso, 一言谈, 小众软件&amp;#8230;&amp;#8230;&amp;#8230;&amp;#8230;..已经让人筋疲力尽了,更不要说web 2.0发展之后, 在发布信息几乎0成本的条件下, 变的更长和更扁平的信息源长尾了.
信息源头现在已经不是问题, 获取信息的成本成了瓶颈.技术的创新, 首先从第3)点上开始帮助人们解决问题.
rss和阅读器的产生, 从信息源被动等待访问, 变成了信息源主动推送. [...]&lt;img src=&quot;http://www1.feedsky.com/t1/335041342/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/45&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041342/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041342/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><category>互联网</category><category>搜索引擎</category><category>sns</category><pubDate>Wed, 17 Jun 2009 02:47:40 +0800</pubDate><author>一陀浆糊</author><comments>http://dajianghu.org/archives/45#comments</comments><guid isPermaLink="false">http://dajianghu.org/?p=45</guid><dc:creator>一陀浆糊</dc:creator><fs:srclink>http://dajianghu.org/archives/45</fs:srclink><fs:srcfeed>http://dajianghu.org/feed</fs:srcfeed><fs:itemid>feedsky/dajianghu/~7587916/335041342/5696998</fs:itemid></item><item><title>读书: 中国文化的深层次结构</title><link>http://dajianghu.org/archives/24</link><content:encoded>&lt;table border=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img class=&quot;alignnone size-full wp-image-25&quot; title=&quot;s1915975-thumb&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/06/s1915975-thumb.jpg&quot; alt=&quot;s1915975-thumb&quot; width=&quot;124&quot; height=&quot;179&quot; /&gt;&lt;/td&gt;
&lt;td&gt;&lt;img class=&quot;alignnone size-full wp-image-26&quot; title=&quot;s3161076-thumb&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/06/s3161076-thumb.jpg&quot; alt=&quot;s3161076-thumb&quot; width=&quot;114&quot; height=&quot;172&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;#8220;中国文化的核心之一就是一个“仁”字。仁者，二人也（圣人的诠释），换句话说，一个人是不是仁者，是他人决定的，而不是自己。如果大家都认为你是仁者，那么，仁者，便无敌了。&amp;#8221;&lt;/p&gt;
&lt;p&gt;据传简体中文版, 略有删节, 未找到电子未删节繁体中文版.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.douban.com/subject/1068912/&quot;&gt;http://www.douban.com/subject/1068912/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;其实所谓仁者, 往往都是忍者.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.douban.com/subject/1068912/&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;alignnone size-full wp-image-27&quot; title=&quot;5445ca086968c2016b60fbe8&quot; src=&quot;http://dajianghu.org/wp-content/uploads/2009/06/5445ca086968c2016b60fbe8.jpg&quot; alt=&quot;5445ca086968c2016b60fbe8&quot; width=&quot;644&quot; height=&quot;484&quot; /&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/335041343/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/24&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041343/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041343/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://dajianghu.org/archives/24/feed</wfw:commentRss><description>&amp;#8220;中国文化的核心之一就是一个“仁”字。仁者，二人也（圣人的诠释），换句话说，一个人是不是仁者，是他人决定的，而不是自己。如果大家都认为你是仁者，那么，仁者，便无敌了。&amp;#8221;
据传简体中文版, 略有删节, 未找到电子未删节繁体中文版.
http://www.douban.com/subject/1068912/
其实所谓仁者, 往往都是忍者.&lt;img src=&quot;http://www1.feedsky.com/t1/335041343/dajianghu/feedsky/s.gif?r=http://dajianghu.org/archives/24&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/dajianghu/335041343/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/dajianghu/335041343/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</description><category>文化</category><category>布可</category><pubDate>Fri, 12 Jun 2009 13:56:03 +0800</pubDate><author>一陀浆糊</author><comments>http://dajianghu.org/archives/24#comments</comments><guid isPermaLink="false">http://dajianghu.org/?p=24</guid><dc:creator>一陀浆糊</dc:creator><fs:srclink>http://dajianghu.org/archives/24</fs:srclink><fs:srcfeed>http://dajianghu.org/feed</fs:srcfeed><fs:itemid>feedsky/dajianghu/~7587916/335041343/5696998</fs:itemid></item></channel></rss>
