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

📄 datatab.h

📁 C语言的朴素贝叶斯分类器代码
💻 H
字号:
#ifndef DATA_TABLE_H#define DATA_TABLE_H#include "table.h"#include <math.h>#include <string.h>// class DataTable is a child class derived from the class// Table. It has a constructor which allow extension to// contain one more column. That column will allow for the// classifier to put their classified valueclass DataTable : public Table {	Description *normalVec;public:	DataTable() : Table() {}	DataTable(Source &src) : Table(src)	{	normalVec = new Description [Col()];//	Normalize();#ifdef DBG3	cout << "Data Table Normalised\n";	printDataTableToOutStream(stdout);#endif	}	DataTable(Source &src, int isExtended) : Table(src, isExtended) {}	void copy(DataTable &tbl);	void copyExtended(DataTable &tbl);	void printDataTableToOutStream(FILE *fp);	void printDataTableRowToOutStream(FILE *fp, int r);	void printDataTable(char *fn=NULL, char *prefix=NULL);	void sort(int column);	void sortWithClass(int column);	int  isWithSameAttributes(int r1, int r2);	void reportInconsistencyRate();	void getMaxMin(int column, Description *max,								Description *min);	void Normalize();	Description *getNormalVec() { return normalVec; }	// Notice: the last item also included in the sort	void QSort(int first, int last, int column);	void QSortWithClass(int first, int last, int column);	void printSee(int begin, int end, int c);	// Sort the instances by the column from "first" to 	// "last". The whole instances would be swapped	void Swap(int a, int b);};// class SupervisedDataTable is a subclass derived from clas// DataTable.class SupervisedDataTable : public DataTable{public:	SupervisedDataTable(Source &src) : DataTable(src) {#ifdef DBG2		cout <<"Supervised: row="<<Row()<<", col="<<Col()<<endl;#endif		}	// return the number of instances	int numOfInstances()  { return Row(); }	// return the number of attributes, excluding the class	// column	int numOfAttributes() { return Col()-1; }};#endif

⌨️ 快捷键说明

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