naivebayes.h
来自「knn和Native Bayes算法实现,两个实现在一起,是数据挖掘和机器学习中」· C头文件 代码 · 共 31 行
H
31 行
#ifndef __NAIVEBAYES_H_
#define __NAIVEBAYES_H_
#pragma warning( disable : 4786 )
#include "doclist.h"
#include <string>
#include <map>
using namespace std;
class CNaiveBayes
{
private:
int m_CatCnt;
long m_DocCnt;
set<int> setWId,setCat;
map<int,double> mapCatId_CatProb;
map<int,long> mapCatId_WordCnt;
map<int,long> mapCatId_DocCnt;
map<int,map<int,double > > mapCatId_WIdProb;
public:
CNaiveBayes();
~CNaiveBayes();
void Train( CDocList& );
int ClassifyDocs( DOC& test_doc );
void ClassifyDocs( string sVectorFile, string sResultFile );
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?