資源簡介
這個和我以前傳的有了一點改動就是把訓練模型和預測分為了2個工程了更方便了 里面有readme.txt. 還可以看看我前面上傳那個工程的“資源描述”

代碼片段和文件信息
#include“GetInfo.h“
#define?space(s)?(s?==?‘?‘?||?s?==?‘\n‘?||?s?==?‘\t‘)
#define??SkipComment while?(?(?c?=?getc(f)?)?!=?‘\n‘?)
void?GetInfo::getname()
{???
char?Buffer[1000];
char?Fn[100];
int?AttCeiling=100;
int?ClassCeiling=100;
int ValCeiling;
filename.copy(Fnfilename.length());
Fn[filename.length()]=NULL;
????strcat_s(Fn“.names“);
if?(?!?(?Nf?=?fopen(Fn?“r“)?)?)?
Error(0?Fn?““);
ClassName?=?(string?*)?calloc(ClassCeiling?sizeof(string));
do
????{
????ReadName(Nf?Buffer);
????if?(?++MaxClassNo?>=?ClassCeiling)
????{
????????ClassCeiling?+=?100;
????????ClassName?=?(string?*)?realloc(ClassName?ClassCeiling*sizeof(string));
????}
????ClassName[MaxClassNo]=string(Buffer);
????}
????while?(?Delimiter?==?‘‘?);
/*??Get?attribute?and?attribute?value?names?from?names?file??*/
????AttName?=?(string?*)?calloc(AttCeiling?sizeof(string));
MaxAttValNo?=?(short?*)?calloc(AttCeiling?sizeof(short));
AttValName?=?(string?**)?calloc(AttCeiling?sizeof(string?*));
????SpecialStatus?=?(char?*)?malloc(AttCeiling);
????while?(?ReadName(Nf?Buffer)?)
????{
????if?(?Delimiter?!=?‘:‘?)?
Error(1?Buffer?““);
????????if?(?++MaxAttNo?>=?AttCeiling?)//擴大空間
????{
????????AttCeiling?+=?100;
????????AttName?=?(string?*)?realloc(AttName?AttCeiling*sizeof(string));
????????MaxAttValNo?=?(short?*)?realloc(MaxAttValNo?AttCeiling*sizeof(short));
????????AttValName?=?(string?**)?realloc(AttValName?AttCeiling*sizeof(string?*));
????????SpecialStatus?=?(char?*)?realloc(SpecialStatus?AttCeiling);
????}
????AttName[MaxAttNo]?=?string(Buffer);
????SpecialStatus[MaxAttNo]?=?0;
????MaxAttValNo[MaxAttNo]?=?0;
????ValCeiling?=?100;
????AttValName[MaxAttNo]?=?(string?*)?calloc(ValCeiling?sizeof(string));
????do
????{
????????if?(?!?(?ReadName(Nf?Buffer)?)?)?
Error(2?AttName[MaxAttNo]?““);
????????if?(?++MaxAttValNo[MaxAttNo]?>=?ValCeiling?)
????????{
????????ValCeiling?+=?100;
????????AttValName[MaxAttNo]?=(string?*)?realloc(AttValName[MaxAttNo]?ValCeiling*sizeof(string));
????????}
????????????AttValName[MaxAttNo][MaxAttValNo[MaxAttNo]]?=?string(Buffer);
????}while?(?Delimiter?==?‘‘?);
????if?(?MaxAttValNo[MaxAttNo]?==?1?)
????{
????????/*??Check?for?special?treatment??*/
????????if?(!strcmp(Buffer?“continuous“)?)
????????{
MaxContAttNo++;
}
?????????else
????????{
?????/*??Cannot?have?only?one?discrete?value?for?an?attribute??*/
?????????Error(3?AttName[MaxAttNo]?““);
????????}
????????MaxAttValNo[MaxAttNo]?=?0;
????}
????else?if?(?MaxAttValNo[MaxAttNo]?>?MaxDiscrValNo?)?
MaxDiscrValNo?=?MaxAttValNo[MaxAttNo];
????}
????fclose(Nf);
}
void???GetInfo::Error(int?n?string?s1?string?s2)
/*??-----??*/
{
????cout<<“ERROR:??“;
????switch(n)
????{
case?0:?cout<<“cannot?open?file?“< break;
case?1: cout<<“colon?expected?after?attribute?name?“< break;
case?2: cout<<“unexpected?EOF?while?reading?attribute?“<
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????410??2009-05-22?22:06??naive?Bayes\data\buycom.data
?????文件?????????47??2009-06-02?16:59??naive?Bayes\data\buycom.model
?????文件????????114??2009-05-22?22:09??naive?Bayes\data\buycom.names
?????文件?????????23??2009-05-22?21:42??naive?Bayes\data\buycomtest.data
?????文件????????415??2009-05-22?22:06??naive?Bayes\data\golf.data
?????文件????????118??2009-05-22?22:06??naive?Bayes\data\golf.names
?????文件????????169??2009-05-22?20:00??naive?Bayes\data\golftest.data
?????文件??????69632??2009-06-02?16:59??naive?Bayes\debug\naive?Bayes.exe
?????文件?????475568??2009-06-02?16:59??naive?Bayes\debug\naive?Bayes.ilk
?????文件?????617472??2009-06-02?16:59??naive?Bayes\debug\naive?Bayes.pdb
?????文件??????69632??2009-06-02?16:59??naive?Bayes\debug\naive?predict.exe
?????文件?????476576??2009-06-02?16:59??naive?Bayes\debug\naive?predict.ilk
?????文件?????560128??2009-06-02?16:59??naive?Bayes\debug\naive?predict.pdb
?????文件??????13788??2009-06-02?16:59??naive?Bayes\naive?Bayes\Debug\BuildLog.htm
?????文件??????81667??2009-06-02?16:59??naive?Bayes\naive?Bayes\Debug\GetInfo.obj
?????文件??????46638??2009-06-02?16:59??naive?Bayes\naive?Bayes\Debug\GetModel.obj
?????文件??????31447??2009-05-26?08:00??naive?Bayes\naive?Bayes\Debug\main.obj
?????文件?????????69??2009-06-02?16:59??naive?Bayes\naive?Bayes\Debug\mt.dep
?????文件????????403??2009-05-18?10:45??naive?Bayes\naive?Bayes\Debug\naive?Bayes.exe.em
?????文件????????468??2009-05-18?10:45??naive?Bayes\naive?Bayes\Debug\naive?Bayes.exe.em
?????文件????????385??2009-06-02?16:59??naive?Bayes\naive?Bayes\Debug\naive?Bayes.exe.intermediate.manifest
?????文件??????78205??2009-05-24?09:29??naive?Bayes\naive?Bayes\Debug\PredictClass.obj
?????文件?????248832??2009-06-02?16:59??naive?Bayes\naive?Bayes\Debug\vc80.idb
?????文件?????225280??2009-06-02?16:59??naive?Bayes\naive?Bayes\Debug\vc80.pdb
?????文件??????13505??2009-05-26?08:03??naive?Bayes\naive?Bayes\GetInfo.cpp
?????文件???????2648??2009-05-26?08:00??naive?Bayes\naive?Bayes\GetInfo.h
?????文件???????2035??2009-05-23?22:38??naive?Bayes\naive?Bayes\GetModel.cpp
?????文件????????419??2009-05-23?19:53??naive?Bayes\naive?Bayes\GetModel.h
?????文件???????1866??2009-05-24?22:31??naive?Bayes\naive?Bayes\main.cpp
?????文件???????4302??2009-05-24?22:31??naive?Bayes\naive?Bayes\naive?Bayes.vcproj
............此處省略38個文件信息
- 上一篇:C語言實現連連看游戲
- 下一篇:DOS操作系統的C語言源代碼
評論
共有 條評論