




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、粗糙集 屬性約簡(jiǎn)題目: SARS 診斷注:這是我學(xué)粗糙集時(shí)老師給的作業(yè) U干咳呼吸困難 血液檢測(cè)高燒38度 X射線濃痰血細(xì)胞多寒戰(zhàn)肌肉酸痛乏力胸膜痛頭痛非典111 1100001101120 0 00000000000310 1000000100040 0 0111101011051 0 01111101100601 01111110010710 00111001110811 11000011011910 111000110
2、11101 1 11000011011111 0 11100011011121 0 11100011011屬性約簡(jiǎn)的順序如下:求正域、生成未經(jīng)處理的區(qū)分矩陣、對(duì)區(qū)分矩陣進(jìn)行化簡(jiǎn)、求核、對(duì)已經(jīng)處理過(guò)的區(qū)分矩陣進(jìn)行屬性約簡(jiǎn)。約簡(jiǎn)后的決策表有26行,所有12個(gè)屬性都是正域中的屬性,核為空 程序:% main.mtic;a= 1,1,1,1,0,0,0,0,1,1,0,1; 0,0,0,0,0,0,0,0,0,0,0,0; 1,0,1,0,0,0,0,0,0,1
3、,0,0; 0,0,0,1,1,1,1,0,1,0,1,1; 1,0,0,1,1,1,1,1,0,1,1,0; 0,1,0,1,1,1,1,1,1,0,0,1; 1,0,0,0,1,1,1,0,0,1,1,1; 1,1,1,1,0,0,0,0,1,1,0,1; 1,0,1,1,1,0,0,0,1,1,0,1; 1,1,1,1,0,0,0,0,1,
4、1,0,1; 1,0,1,1,1,0,0,0,1,1,0,1; 1,0,1,1,1,0,0,0,1,1,0,1 ;d=1;0;0;0;0;0;0;1;1;1;1;1;pos=posCD(a,d);dismat=dismatrix(a,d,pos);dism=disbe(dismat);core=cor(dism);red,row=redu(dism);time=toc% dismatrix.m% 生成未經(jīng)處理的區(qū)分矩陣dismatfunction dismat=dismatrix(a,d,pos)m,n=size(a);p
5、=1;index1=0;index2=0;index=0;dis=-1*ones(m*(m-1)/2,n);for i=1:m for j=i+1:m if (isxbelongtopos(i,pos)&isxbelongtopos(j,pos). |(isxbelongtopos(i,po
6、s)&isxbelongtopos(j,pos). |(isxbelongtopos(i,pos)&isxbelongtopos(j,pos)&isxybelongtoindD(i,j,d) index2=1;
7、60; end if index2=0 continue; end for k=1:n
8、; if a(i,k)=a(j,k) dis(p,k)=1; index1=1; e
9、lse dis(p,k)=0; end end if index1=1 p=p+1;index=1;
10、0; end index1=0; index2=0; endendif p<=m*(m-1)/2 if index=0 dismat=; return;
11、; end if dis(p,1)=-1 p=p-1; endelse p=m*(m-1)/2;enddismat=dis(1:p,:);% redu.m% 對(duì)已經(jīng)處理過(guò)的區(qū)分矩陣進(jìn)行知識(shí)約簡(jiǎn)function red,row=redu(dism)m,n=size(dism);red=;row=0;if m<=0 return;endfor i=1:n &
12、#160; if dism(1,i)=0 row=row+1; endendred(1:row,:)=zeros(row,n);j=1;for i=1:row while dism(1,j)=0 j=j+1; end red(i,j)=1; j=j+1
13、;endtemp=;tempdis=;rowd=0;rowd1=0;for i=2:m j=1; while j<=row temp=uni(dism(i,:),red(j,:); s,n=size(temp); rowd1=rowd+s;
14、60; tempdis(rowd+1:rowd1,:)=temp; rowd=rowd1; j=j+1; temp=; end red=; red=disbe(tempdis); &
15、#160; tempdis=; row,n=size(red); rowd=0;rowd1=0;end % disbe.m% 對(duì)區(qū)分矩陣或者約簡(jiǎn)矩陣進(jìn)行化簡(jiǎn)即去掉包含關(guān)系function dism=disbe(dis)m,n=size(dis);p=m;for i=1:m if dis(i,1)=-1 for j=1:m
16、160; if i=j & dis(j,1)=-1 if dis(i,:)<=dis(j,:)
17、 dis(j,1)=-1; p=p-1; elseif dis(i,:)>=dis(j,:)
18、; dis(i,:)=dis(j,:); dis(j,1)=-1;
19、60; p=p-1; end end
20、 end endenddism=ones(p,n);j=1;for i=1:p while j<=m & dis(j,1)=-1 j=j+1; end dism(i,:)=dis(j,:);
21、 j=j+1;end % posCD.m% a為條件屬性矩陣,d為決策屬性向量% pos為正域,保存條件屬性矩陣的索引值function pos=posCD(a,d)m,n=size(a);p=m;index=0;for i=1:m if a(i,1)=-1 for j=i+1:m if a(j,1)
22、=-1 &(a(i,:)=a(j,:)&d(i)=d(j) a(j,1)=-1;p=p-1;index=1; end end
23、160; if index=1 a(i,1)=-1;p=p-1;index=0; end endendpos=zeros(p,1);i=1;for r=1:p while a(i,1)=-1&i<=m
24、i=i+1; end pos(r)=i; r=r+1; i=i+1;end % cor.m% 對(duì)已經(jīng)處理過(guò)的區(qū)分矩陣求核function core=cor(dism)m,n=size(dism);core1=zeros(1,n);number=0;for i=1:m num=0;p=0; for j=1:n
25、60; if dism(i,j)=0 num=num+1; p=j; end end if num=1
26、60; core1(p)=1; number=number+1; endendif number=0 core=0;else core=zeros(1,number); j=1; for i=1:number while core1(j)=
27、0 j=j+1; end core(i)=core1(j); j=j+1; endend % uni.m%對(duì)區(qū)分矩陣的第i行和red(j,:)運(yùn)算,即將a中%所有的1分別插入到red(j,:)中,待去掉包含關(guān)系function tempred=uni(disa,red)m,n=size(red);num=0;for i=1:n if disa(i)=0 num=num+1;
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年拉薩貨運(yùn)從業(yè)資格證考試試題及答案解析
- 保障性合同范本
- 區(qū)域總經(jīng)理合同范本
- 醫(yī)療就業(yè)合同范本
- 包食堂合同范本
- 促銷(xiāo)活動(dòng)場(chǎng)地出租合同范本
- 農(nóng)村電商合同范本
- 利用合同范本
- 前廳接待勞務(wù)合同范本
- 5人合作合同范本
- 七年級(jí)下冊(cè)《平行線的判定》課件與練習(xí)
- 2025年中考英語(yǔ)時(shí)文閱讀 6篇有關(guān)電影哪吒2和 DeepSeek的英語(yǔ)閱讀(含答案)
- 修高速土方合同范例
- 2024年湖北省武漢市中考語(yǔ)文試卷
- 二零二五年度高品質(zhì)小區(qū)瀝青路面翻新施工與道路綠化合同2篇
- 2024年形勢(shì)與政策復(fù)習(xí)題庫(kù)含答案(綜合題)
- 2022年北京市初三一模語(yǔ)文試題匯編:基礎(chǔ)知識(shí)綜合
- 2025年廣東食品藥品職業(yè)學(xué)院高職單招高職單招英語(yǔ)2016-2024年參考題庫(kù)含答案解析
- 2 爆破工試題及答案
- 電路基礎(chǔ)知到智慧樹(shù)章節(jié)測(cè)試課后答案2024年秋江西職業(yè)技術(shù)大學(xué)
- DCMM數(shù)據(jù)管理師練習(xí)測(cè)試卷
評(píng)論
0/150
提交評(píng)論