资源简介
广工人工智能——决策树实验报告.rar
代码片段和文件信息
#include
#include
#include
#include “id3.h“
//初始化样本集
struct sample_set* initSampleSet(){
struct sample_set* sampleSet = (struct sample_set*)malloc(sizeof(struct sample_set));
sampleSet->length = SAMPLE_COUNT;
sampleSet->samples = (struct sample*)malloc(sizeof(struct sample)*SAMPLE_COUNT);
//样本信息
sampleSet->samples[0].attrValue[0] = HEADACHE;
sampleSet->samples[0].attrValue[1] = COURBATURE;
sampleSet->samples[0].attrValue[2] = NORMAL_TEMP;
sampleSet->samples[0].c = NOT_ILL;
sampleSet->samples[1].attrValue[0] = HEADACHE;
sampleSet->samples[1].attrValue[1] = COURBATURE;
sampleSet->samples[1].attrValue[2] = HIGH_TEMP;
sampleSet->samples[1].c = IS_ILL;
sampleSet->samples[2].attrValue[0] = HEADACHE;
sampleSet->samples[2].attrValue[1] = COURBATURE;
sampleSet->samples[2].attrValue[2] = VERY_HIGH_TEMP;
sampleSet->samples[2].c = IS_ILL;
sampleSet->samples[3].attrValue[0] = UN_HEADACHE;
sampleSet->samples[3].attrValue[1] = COURBATURE;
sampleSet->samples[3].attrValue[2] = NORMAL_TEMP;
sampleSet->samples[3].c = NOT_ILL;
sampleSet->samples[4].attrValue[0] = UN_HEADACHE;
sampleSet->samples[4].attrValue[1] = UN_COURBATURE;
sampleSet->samples[4].attrValue[2] = HIGH_TEMP;
sampleSet->samples[4].c = NOT_ILL;
sampleSet->samples[5].attrValue[0] = UN_HEADACHE;
sampleSet->samples[5].attrValue[1] = COURBATURE;
sampleSet->samples[5].attrValue[2] = VERY_HIGH_TEMP;
sampleSet->samples[5].c = IS_ILL;
sampleSet->samples[6].attrValue[0] = HEADACHE;
sampleSet->samples[6].attrValue[1] = UN_COURBATURE;
sampleSet->samples[6].attrValue[2] = HIGH_TEMP;
sampleSet->samples[6].c = IS_ILL;
return sampleSet;
}
//初始化属性列
struct attribute_list* initAttrList(){
struct attribute_list* attributeList = (struct attribute_list*)malloc(sizeof(struct attribute_list));
attributeList->length = ATTRIBUTE_COUNT;
attributeList->attrList = (int*)malloc(sizeof(int)*ATTRIBUTE_COUNT);
attributeList->attrList[0] = 0;
attributeList->attrList[1] = 1;
attributeList->attrList[2] = 2;
attributeList->length = ATTRIBUTE_COUNT;
return attributeList;
}
//判断样本集是否都是属于同一类
bool Similar(struct sample_set* sampleSet){
if(sampleSet->length > 1){
int c = sampleSet->samples[0].c;
for(int i=1; ilength; i++){
if(sampleSet->samples[i].c != c){
return false;
}
}
}
return true;
}
//获取普通类
int getCommonC(struct sample_set* sampleSet){
int c[C_COUNT];
int icommonC = 0;
for(i=0; i c[i] = 0;
}
for(i=0; ilength; i++){
c[sampleSet->samples[i].c]++;
}
for(i=1; i if(c[commonC] < c[i]){
commonC = i;
}
}
return commonC;
}
//将样本按照某一属性划分
struct sample_set* split(struct sample_set* sampleSetint attribute){
int ij;
//属性attribute所有取值的个数
int setLength = attributes[attribute].length;
struct sample_set* S = (struct sample_set*)malloc(sizeof(struct sample_set)*setLength
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 221266 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\Debug\ID3.exe
文件 213884 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\Debug\ID3.ilk
文件 20180 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\Debug\id3.obj
文件 234952 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\Debug\id3.pch
文件 484352 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\Debug\ID3.pdb
文件 50176 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\Debug\vc60.idb
文件 53248 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\Debug\vc60.pdb
文件 10975 2016-12-05 22:15 人工智能决策树实验报告\决策树\ID3\id3.cpp
文件 3365 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\id3.dsp
文件 514 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\id3.dsw
文件 2967 2016-12-04 21:44 人工智能决策树实验报告\决策树\ID3\id3.h
文件 58368 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\ID3.ncb
文件 48640 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\id3.opt
文件 735 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\ID3.plg
文件 48640 2016-11-24 18:41 人工智能决策树实验报告\决策树\ID3\决策树ID3算法实验报告.doc
文件 145408 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3算法实验报告.doc
目录 0 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3\Debug
目录 0 2019-12-08 16:54 人工智能决策树实验报告\决策树\ID3
目录 0 2019-12-08 16:55 人工智能决策树实验报告\决策树
目录 0 2016-12-27 10:45 人工智能决策树实验报告
----------- --------- ---------- ----- ----
1597670 20
相关资源
- zw_abc3240666-3453652-MyQQ_lide.zip
- 尚硅谷运维学科全套视频.txt
- 2019年西门子杯全国大学生工程设计文
- zw_xinhuojianke-10555810-PSO工具箱.zip
- zw_u013257257-9329537-工资系统.zip
- zw_shiyideliutang-10418313-v_f_control_system1
- zw_qq_26496915-8797777-acllib.zip
- zw_pixiuli-9947751-SLEP_package_4.1.zip
- zw_piaoen2-10978481-6a931d790e1e449e86a9e30086
- zw_liuqiwuhan-10171406-aaa.zip
- zw_wangjunfeibj-4044319-wyLogistics.zip
- zw_vnsoft-10755608-vnsoft_select_disabled.zip
- zw_u014306011-8895689-8533c095993c002f890bc45c
- zw_readhere-10496792-5G入门指南.zip
-
zw_qq_43189738-10871297-unti
tled5.zip - zw_qq_40428630-10566924-仿真K热电偶改变抬
- zw_qq_36868319-10764167-寻迹传感器模块T
- zw_qq_15051671-7285975-VVVF.zip
- zw_gohay1-940263-Bus.zip
- zw_weixin_44605584-10980840-RSFCL.zip
- zw_w1152715961-10124916-trac_light.zip
- zw_shelden_-11057537-geebinfmodifiedbyzz.zip
- zw_rice1348-1887646-.zip
- zw_renoh-1352592-53607892moni2.zip
- zw_qq_42820892-10774482-光谱响应函数.zip
- zw_qq_42617475-10543635-Desktop.zip
- zw_qq_41024400-10425875-多目标perota优化问
- zw_qq_37153706-10864156-2018年9月2日脚本更
- zw_qq_27108017-8608901-RHC.zip
- zw_q514004204-10166342-BookStore.zip
评论
共有 条评论