sunnymarkliu / naive_bayes_meet_adaboost Goto Github PK
View Code? Open in Web Editor NEW:email: Implement Naive Bayes and Adaboost from scratch and use them to filter spam emails.
:email: Implement Naive Bayes and Adaboost from scratch and use them to filter spam emails.
您好,请问Adaboost部分的代码是否有相关的理论依据(比如论文)?感觉其和西瓜书上的Adaboost算法描述差别有些大。
请问这个数据集是在哪里找到的啊
请问:
p1 = sum(testWordsMarkedArray * pWordsSpamicity) + np.log(pSpam)
这个公式不太明白,不因该是(testWordsMarkedArray * pWordsSpamicity) 里不为零的值相乘得到P(W|C)吗?
已解决,训练时 pWordsSpamicity 取了对数。
您好:
所以最终比较的是,P(W1|S)P(W2|S)....P(Wn|S)P(S)和P(W1|H)P(W2|H)....P(Wn|H)P(H)的大小
可能是我理解错了,但是我觉得比较公式应该是
P(W1|S)P(W2|S)....P(Wn|S)*P(S)^n和P(W1|H)P(W2|H)....P(Wn|H)*P(H)^n的大小
请问testWordsMarkedArray指的是什么呢?
没有python基础看得有些吃力……不好意思哈
DS计算部分: alpha是不是写错了?
alpha = ps - ph
if alpha < 0: # 原先为spam,预测成ham
DS[testWordsCount != 0] = np.abs((DS[testWordsCount != 0] - np.exp(alpha)) / DS[testWordsCount != 0])
else: # 原先为ham,预测成spam
DS[testWordsCount != 0] = (DS[testWordsCount != 0] + np.exp(alpha)) / DS[testWordsCount != 0]
改成
alpha = ps - ph
if alpha > 0: # 原先为ham,预测成spam
DS[testWordsCount != 0] = np.abs((DS[testWordsCount != 0] - np.exp(alpha)) / DS[testWordsCount != 0])
else: # 原先为spam,预测成ham
DS[testWordsCount != 0] = (DS[testWordsCount != 0] + np.exp(alpha)) / DS[testWordsCount != 0]
错误率更低了。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.