📄 rawdatatable.c
字号:
#include "rawDataTable.h"RawDataTable::RawDataTable(SupervisedDataTable &sDTbl): DataTable(){ copyExtended((DataTable)sDTbl); }RawDataTable::RawDataTable(Source &src, SupervisedDataTable &sDTbl):DataTable(src, 1){#ifdef DBG cout << "sDTbl.numOfAttr="<<sDTbl.numOfAttributes() << ", " << "src.numOfDesc="<<src.numOfDescriptions() << endl;#endif ERROR1((sDTbl.numOfAttributes() == (src.numOfDescriptions()-1)), "RawDataTable::constructor: the training data has a \\n number of columns different from the testing's");#ifdef DBG cout << "RawDataTable::constructor shows the data\n"; DataTable::print();#endif}void RawDataTable::setClassField(int r, Description d){ setValue( r, Col()-1, d);}void RawDataTable::print(){ for(int r=0; r<Row(); r++) { int c; for(c=0; c<Col()-2; c++) cout << value(r, c) << " "; cout << " | " << value(r, c++) << " | "; if(value(r, c) == ERRORVALUE) cout << "UNKNOWN"; else if(value(r,c) != value(r,c-1)) cout << "ERROR:"; cout << value(r, c) << " "; cout << endl; }}void RawDataTable::reportErrorRate(){ int n_Errors = 0; int c = Col() - 1;#ifdef DBG cout << "Total number of instances: " << Row() <<endl;#endif for(int r=0; r<Row(); r++) if(value(r, c) == ERRORVALUE || value(r,c) != value(r,c-1)) n_Errors ++; cout << "The error rate: " <<n_Errors<<"/"<<Row()<<"="<<(float)n_Errors/Row()*100 <<"%"<<endl;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -