垃圾邮件分类器的原理(1)

学习完了斯坦福大学《机器学习》第7周课程,做完编程作业垃圾邮件分类器,准备分享下实现原理和实现方法,对自己也是起到总结作用,对博友是个参考,估计得写好几篇才能讲完,这是第一篇。

第二篇的地址:垃圾邮件分类器的原理(2)

先看运行结果:

训练样本有4000个,测试样本有1000个,结果显示判断准确率都在98%以上

Preprocessing sample email (emailSample1.txt)


==== Processed Email ====


anyon know how much it cost to host a web portal well it depend on how mani
visitor you re expect thi can be anywher from less than number buck a month
to a coupl of dollarnumb you should checkout httpaddr or perhap amazon ecnumb
if your run someth big to unsubscrib yourself from thi mail list send an
email to emailaddr


=========================
Word Indices:
 86 916 794 1077 883 370 1699 790 1822 1831 883 431 1171 794 1002 1893 1364 592 1676 238 162 89 688 945 1663 1120 1062 169
9 375 1162 479 1893 1510 799 1182 1237 810 1895 1440 1547 181 1699 1758 1896 688 1676 992 961 1477 71 530 1699 531


Program paused. Press enter to continue.


Extracting features from sample email (emailSample1.txt)


==== Processed Email ====


anyon know how much it cost to host a web portal well it depend on how mani
visitor you re expect thi can be anywher from less than number buck a month
to a coupl of dollarnumb you should checkout httpaddr or perhap amazon ecnumb
if your run someth big to unsubscrib yourself from thi mail list send an
email to emailaddr


=========================
Length of feature vector: 1899
Number of non-zero entries: 45
Program paused. Press enter to continue.


Training Linear SVM (Spam Classification)
(this may take 1 to 2 minutes) ...


Training ......................................................................
...............................................................................
...............................................................................
............................................................. Done!


Training Accuracy: 99.875000


Evaluating the trained Linear SVM on a test set ...
Test Accuracy: 98.700000


Top predictors of spam:
 our             (0.503462)
 click           (0.468912)
 remov           (0.419352)
 guarante        (0.385077)
 visit           (0.365506)
 basenumb        (0.353562)
 dollar          (0.330829)
 will            (0.266236)
 price           (0.265347)
 pleas           (0.262004)
 most            (0.261452)
 lo              (0.254036)
 nbsp            (0.252983)
 al              (0.239734)
 dollarnumb      (0.238813)






Program paused. Press enter to continue.


==== Processed Email ====


do you want to make dollarnumb or more per week if you ar a motiv and qualifi
individu i will person demonstr to you a system that will make you dollarnumb
number per week or more thi is not mlm call our number hour pre record number
to get the detail number number number i need peopl who want to make seriou

monei make the call and get the fact invest number minut in yourself now
number number number look forward to your call and i will introduc you to
peopl like yourself who ar current make dollarnumb number plu per week number
number number numberljgvnumb numberleannumberlrmsnumb
numberwxhonumberqiytnumb numberrjuvnumberhqcfnumb numbereidbnumberdmtvlnumb


=========================


Processed spamSample1.txt
请看第二篇垃圾邮件分类器的原理(2)

Spam Classification: 1
(1 indicates spam, 0 indicates not spam)

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值