本站网址: YippeeSoft开心软件
20071022 bayes 垃圾邮件 becky
http://www.yippeesoft.com
慢慢的发现新的东西好玩的越来越多,对B2的兴趣也小了很多
现在才发现居然已经到了2.40了 :)
foxmail不支持MAPI,支持RSS和BAYES,这个倒无所谓。只是垃圾邮件。。。。
找了找资料:
如果我想作个BAYES插件,那么除了熟悉BAYES应用之外,还需要进行分词。。。。。
注册时间: 2004-三月-20
在线状态: 离线
点击: 40
发表于: 2004-四月-12 1:45下午 &line; IP已记录 引用 ayaya
1. Spampal可以通过插件支持贝叶斯算法,在http://www.spampal.org/plugins.html下载Bayesian Plugin,拷贝到plugin目录下即可,与一般的Bayesian设置方法一样。Bayesian插件与Spampal本身的过滤结合的非常好,我现在就是这样用的。
K9最新版本1.27,主页地址http://keir.net/k9.html ,77K。支持黑白名单过滤、sbl垃圾IP地址过滤(主要是对国外的IP地址有效),支持贝叶斯过滤。它的工作原理是作为Be cky!和邮件服务器中间的过滤代理,首先对服务器上的邮件收取,分析之后,对垃圾邮件会加上标识,而Becky!则从K9处收 取邮件,由于垃圾邮件已经被标识过了,因此可以通过一个简单的邮件分拣规则把这些邮件直接送到垃圾油箱中去。
BkBogofilter v1.1.1
BkBogofilter is a port of Bogofilter v1.1.1 as a plugin for Becky! Internet Mail version 2.
Bayes++ is a library of C++ classes that implement numerical algorithms for Bayesian Filtering. They provide tested and consistent numerical methods and the class hierarchy represents the wide variety of Bayesien filtering algorithms and system models.
叶斯过滤器为什么能够工作得这么好呢?因为贝叶斯过滤器纯粹根据统计学规律运作,比起那些需要分析邮件句法或内容含义的过滤器来显然要简单的多,而且可计算性强得多。更重要的是,这些标记完全可以由用户根据自己所接收的垃圾邮件和非垃圾邮件来创建,因而可以获得一种对用户来说独一无二的过滤器。这意味着垃圾邮件发送者根本无法猜测出你的过滤器是如何配置的,从而有效地阻截住各类垃圾邮件。
贝叶斯介绍
贝叶斯是基于概率的一种算法,是Thomas Bayes:一位伟大的数学大师所创建的,目前此种算法用于过滤垃圾邮件得到了广泛地好评。贝叶斯过滤器是基于“自我学习”的智能技术,能够使自己适应垃圾邮件制造者的新把戏,同时为合法电子邮件提供保护。在智能邮件过滤技术中,贝叶斯(Bayesian)过滤技术取得了较大的成功,被越来越多地应用在反垃圾邮件的产品中。
二、 贝叶斯过滤算法的基本步骤
1. 收集大量的垃圾邮件和非垃圾邮件,建立垃圾邮件集和非垃圾邮件集。
2. 提取邮件主题和邮件体中的独立字符串,例如 ABC32,¥234等作为TOKEN串并统计提取出的TOKEN串出现的次数即字频。按照上述的方法分别处理垃圾邮件集和非垃圾邮件集中的所有邮件。
3. 每一个邮件集对应一个哈希表,hashtable_good对应非垃圾邮件集而hashtable_bad对应垃圾邮件集。表中存储TOKEN串到字频的映射关系。
4. 计算每个哈希表中TOKEN串出现的概率P=(某TOKEN串的字频)/(对应哈希表的长度)
5. 综合考虑hashtable_good和hashtable_bad,推断出当新来的邮件中出现某个TOKEN串时,该新邮件为垃圾邮件的概率。数学表达式为:
A 事件 —- 邮件为垃圾邮件;
t1,t2 …….tn 代表 TOKEN 串
则 P ( A&line;ti )表示在邮件中出现 TOKEN 串 ti 时,该邮件为垃圾邮件的概率。
设
P1 ( ti ) = ( ti 在 hashtable_good 中的值)
P2 ( ti ) = ( ti 在 hashtable_ bad 中的值)
则 P ( A&line;ti ) =P2 ( ti ) /[ ( P1 ( ti ) +P2 ( ti ) ] ;
6. 建立新的哈希表hashtable_probability存储TOKEN串ti到P(A&line;ti)的映射
7. 至此,垃圾邮件集和非垃圾邮件集的学习过程结束。根据建立的哈希表 hashtable_probability可以估计一封新到的邮件为垃圾邮件的可能性。
当新到一封邮件时,按照步骤2,生成TOKEN串。查询hashtable_probability得到该TOKEN 串的键值。
假设由该邮件共得到N个TOKEN 串,t1,t2…….tn,hashtable_probability中对应的值为 P1 , P2 , ……PN , P(A&line;t1 ,t2, t3……tn) 表示在邮件中同时出现多个TOKEN串t1,t2……tn时,该邮件为垃圾邮件的概率。
由复合概率公式可得
P(A&line;t1 ,t2, t3……tn)=(P1*P2*……PN)/[P1*P2*……PN+(1-P1)*(1-P2)*……(1-PN)]
当 P(A&line;t1 ,t2, t3……tn) 超过预定阈值时,就可以判断邮件为垃圾邮件。
结合传统贝叶斯算法的数学定理,给出了朴素贝叶斯过滤算法以及该算法在反垃圾邮件中的六个处理步骤,算法通过渐进学习的方式分别建立三个哈希表,并预置相应的阀值来判定收到的邮件是否为垃圾邮件。以实例方式说明了此算法为基础的反垃圾邮件策略,最后指出了朴素贝叶斯算法存在的问题及可能改进的方向,对防范和处理垃圾邮件提供理论依据和实践参考。
BkBogofilter垃圾过滤插件不错,可到[url]http://www.mickeytheman.com/forums/index.php?showtopic=3731[/url]下载。
安装此插件后,在邮件标题上点击右键,出现"Bogofilter: Register as Ham"和"Bogofilter: Register as Spam"选项,前者是表示标记邮件为非垃圾邮件,后者表示标记邮件为垃圾邮件。经过一些邮件的训练,就可以过滤垃圾邮件了,方法如下:
使用此插件后,每封邮件的邮件头会出现类似"X-Bogosity: Spam, tests=bogofilter, spamicity=1.000000, version=1.0.2"的东东,"spamicity="后面的数值代表垃圾邮件的垃圾程度。
我是按照spamicity=1.0设一个过滤条件、spamicity=0.9设一个过滤条件、spamicity=0.8设一个过滤条件、spamicity=0.7设一个过滤条件、spamicity=0.6设一个过滤条件,将符合这些条件的邮件统统都放到废件箱。
用上述方法可过滤绝大部分的邮件,使用效果不错,大家可以试试。
Bogofilter is a mail filter that classifies mail as spam or ham (non-spam) by a statistical analysis of the message\’s header and content (body). The program is able to learn from the user\’s classifications and corrections.
The statistical technique is known as the Bayesian technique and its use for spam was described by Paul Graham in his article A Plan For Spam in August 2002. Gary Robinson, in his weblog Rants (September 2002), suggested some refinements for improved discrimination between spam and ham. Bogofilter\’s primary algorithm uses the f(w) parameter and the Fisher inverse chi-square technique that he describes. Paul Graham\’s new article Better Bayesian Filtering (January 2003) suggests some useful parsing improvements.
Bogofilter is run by an MDA script to classify an incoming message as spam or ham (using wordlists stored by BerkeleyDB). Bogofilter provides processing for plain text and html. It supports multi-part mime message with decoding of base64, quoted-printable, and uuencoded text and ignores attachments, such as images.
Bogofilter is written in C. Supported platforms: Linux, FreeBSD, Solaris, OS X, HP-UX, AIX, RISC OS, SunOS, OS/2 …
Bayesian Filtering is a probabilistic technique for data fusion. The technique combines a concise mathematical formulation of a system with observations of that system. Probabilities are used to represent the state of a system, likelihood functions to represent their relationships. In this form Bayes rule can be applied and further related probabilities deduced.
For discrete systems the Bayesian formulation results in a naturally iterative data fusion solution. For dynamic systems there is a class of solutions, discreate filters, that combine observed inputs to the system with the dynamic model . A filter that iteratively incorporates new information is an estimator. For linear dynamic systems, discrete solutions such as the Kalman filter apply.
Bayes++ is a library of C++ classes. These classes represent and implement a wide variety of numerical algorithms for Bayesian Filtering of discrete systems. The classes provide tested and consistent numerical methods and the class hierarchy explicitly represents the variety of filtering algorithms and system model types.
原创文章,转载请注明: 转载自YippeeSoft开心软件
本文链接地址: 20071022 bayes 垃圾邮件 becky
历史博文
- ubuntu svn - 2010
- 20081112 css form - 2009
- 20070216 opennms install 3 - 2007
- 0316 OnDO SIP Server install - 2006
- Subversion Documentation翻译1目录 - 2005
- Keil uVision c51 agsi 插件DLL制作6 - 2005
- Keil uVision c51 agsi 插件DLL制作5 - 2005
- Keil uVision c51 agsi 插件DLL制作4 - 2005
- Keil uVision c51 agsi 插件DLL制作3 - 2005
- Keil uVision c51 agsi 插件DLL制作2 - 2005
评论