資源簡介
用matlab實(shí)現(xiàn)的樸素貝葉斯分類器,比較簡單,有助于理解樸素貝葉斯。代碼直接可用。

代碼片段和文件信息
function?[?type?]?=?classifyNB(?vec2classifyp0vp1vpclass1?)
%UNtitleD5?Summary?of?this?function?goes?here
%???Detailed?explanation?goes?here
p1?=?sum(vec2classify?.*?p1v)?+?log(pclass1);
p0?=?sum(vec2classify?.*?p0v)?+?log(1-pclass1);
if?p1?>?p0
????type?=?1;
else
????type?=?0;
end
end
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????309??2015-11-18?15:59??bayes\classifyNB.m
?????文件????????232??2015-11-18?14:46??bayes\createVocabList.m
?????文件???????1013??2015-11-18?16:00??bayes\exerciseNB0.m
?????文件????????401??2015-11-18?15:14??bayes\setOfWords2Vec.m
?????文件????????718??2015-11-18?15:52??bayes\trainNB0.m
?????目錄??????????0??2015-12-02?20:47??bayes
-----------?---------??----------?-----??----
?????????????????2673????????????????????6
評(píng)論
共有 條評(píng)論