📄 disctable.h
字号:
#ifndef DISCTABLE_H#define DISCTABLE_H#include "dataTab.h"#include <time.h>#include <sys/resource.h>class DiscreteTable : public SupervisedDataTable {public: Description **DiscTable; int *DiscTableSize; static const int LARGE_NUM = 99999999; int *nValuesBefore; static const int NO_BEST_CUT = 2; Description MaxClass; DiscreteTable(Source &src) : SupervisedDataTable(src) { DiscTable = new Description *[Col()-1]; DiscTableSize = new int[Col()-1]; nValuesBefore = new int [Col()-1]; MaxClass = 1+getMaxClass(); // this is to have the actual maximal class considered } // check whether the class labels, between [l,r] // inclusively, are the same or not int isSameClass(int l, int r); Description **getDiscTablePtr() { return DiscTable; } int *getDiscTableSizePtr() { return DiscTableSize; } // get the first boundary in [left, right] interval based // on Elomaa & Rousu's definition (1996) // the boundary is the first after the "left" int getBoundary(int left, int right, int c); // returns an array, which is already allocated, consists // of the boundary index int buildBoundaryTable(int *disc, int c); // call this function to discretize the training data // table void discretizeTable(); void discretizeToIntTable(); // user define discretization process // but he needs to call "getCutsTable()" and he needs // to assign the cut points to the "DiscTable" and record // down the number of cut points in each column within the // "getCutsTable()". void discretizeToIntTableUDF(); void getCutsTable() {} // return the numerically maximal class label Description getMaxClass(); // output the discrete cut table void printDiscreteCutTable(char *name = NULL); // output the discrete data table void printDiscreteDataTable(char *name = NULL); // discretize the specific column to real number format void discretizeOnCol(int c); // discretize to int number format void discretizeToIntOnCol(int c); // discretize to real number format for future visualization void discretizeTable(SupervisedDataTable &tt); // discretize to int number format void discretizeToIntTable(SupervisedDataTable &tt); void printAllAttributeInfo(); int getNumOfAttributeValues(int c); void getAttrInfoBeforeDisc(); // this function will be implemented independently for // each algorithm virtual void getCutsOnCol(int c) = 0; void cleanCntV(int *cntV); void getClassCntV(int *cntV, int left, int right); int countNumOfClass(int *cntV); int countNumOfClass(int *lCntV, int *rCntV); // it will return the next boundary where the value is // still the same as the value at row: begin int getSameValueBoundary(int begin, int c); // Input:- // begin: is the row where to start to check // c : is the column // next : is the row where it has the same value as the // row: "begin" // // Return value: // on success, it returns the 1, ie. the value at // value(begin, c) always has pure classes. And it also // returns through parameter "next", whose value is the // same as the row "begin". int isValueHasPureClass(int begin, int c, int &next);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -