⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attributeinfo.h

📁 C语言的朴素贝叶斯分类器代码
💻 H
字号:
#ifndef ATTRIBUTE_TABLE_H#define ATTRIBUTE_TABLE_H#include "dataTab.h"#include "classInfo.h"class AttributeInfo {public:	Description   value;	int           *count;	int           n_Class;	AttributeInfo *next;	AttributeInfo(Description d, int n) {		value = d; n_Class = n; 		count = new int[n];		for(int i=0; i<n; i++) count[i] =0; // initialise to ZERO		next = NULL; }		// increment the count value for that particular class i	void inc(int i) { count[i] ++; } // i is the particular class label	// return the count value for that particular class i	int getCount(int i) { return count[i]; } // i is the class label	void print(ClassSummary &cSTbl); // print the contents};// The following is a Table class of AttributeInfo type.class AttributeInfoTable {	int n_Values;  // Number of the distinct values	int n_Class;   // Number of the total classes derived from	               // the SupervisedDataTable	SupervisedDataTable *sTable;	AttributeInfo *table[MAX_HASH_SIZE];  // a hash tablepublic:	AttributeInfoTable(SupervisedDataTable &tbl, int col,									ClassInfoTable &cTbl);	int numOfValues() { return n_Values; }	// search the Description value in the hash table. return	// NULL if not found, otherwise return the pointer to the	// AttributeInfo Node.	AttributeInfo *searchInfo(int hashVal, Description v);	AttributeInfo *searchInfo(Description v);	int hash(Description d) { return abs((int)d %									MAX_HASH_SIZE); }	// Set NULL pointer for the hash table	void initHashTable();	// print out the probability distribution of the classes	void print(ClassSummary *cSTable);};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -