《模式識(shí)別》課程實(shí)驗(yàn)線性分類器設(shè)計(jì)實(shí)驗(yàn)_第1頁(yè)
《模式識(shí)別》課程實(shí)驗(yàn)線性分類器設(shè)計(jì)實(shí)驗(yàn)_第2頁(yè)
《模式識(shí)別》課程實(shí)驗(yàn)線性分類器設(shè)計(jì)實(shí)驗(yàn)_第3頁(yè)
《模式識(shí)別》課程實(shí)驗(yàn)線性分類器設(shè)計(jì)實(shí)驗(yàn)_第4頁(yè)
《模式識(shí)別》課程實(shí)驗(yàn)線性分類器設(shè)計(jì)實(shí)驗(yàn)_第5頁(yè)
已閱讀5頁(yè),還剩5頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、模式識(shí)別課程實(shí)驗(yàn)線性分類器設(shè)計(jì)實(shí)驗(yàn)一、實(shí)驗(yàn)?zāi)康模?、掌握Fisher線性分類器設(shè)計(jì)方法;2、掌握感知準(zhǔn)則函數(shù)分類器設(shè)計(jì)方法。二、實(shí)驗(yàn)內(nèi)容:1、對(duì)下列兩種情況,求采用Fisher判決準(zhǔn)則時(shí)的投影向量和分類界面,并做圖。,(2,0,(2,2)t,(2,4)t,(3,3)t1,(0,3)T,(-2,2)t,(-1,-1)T,(1,-2)t,(3,1)t2,(1,1)t,(2,0)t,(2,1)t,(0,2)t,(1,3)t1,(-1,2)t,(0,0)t,(-1,0),(-1,-1)t,(0,-2)t22、對(duì)下面的兩類分類問題,采用感知準(zhǔn)則函數(shù),利用迭代修正求權(quán)向量的方法求兩類的線性判決函數(shù)及線性識(shí)

2、別界面,并畫出識(shí)別界面將訓(xùn)練樣本區(qū)分的結(jié)果圖。,(1,1)T,(2,0)t,(2,1)T,(0,2)t,(1,3)T1,(-1,2)t,(0,0)t,(-1,0),(-1,-1)t,(0,-2)t2三、實(shí)驗(yàn)原理:Fisher判決準(zhǔn)則投影方向:w*,S-i(卩一卩)w12感知準(zhǔn)則函數(shù):J(v),工(-VTZ)z,Zk當(dāng)Zk為空時(shí),即J(v)0,v*即為所求p四、解題思路:1、fisher線性判決器:用mean函數(shù)求兩類樣本的均值求兩類樣本的均值的類內(nèi)離散矩陣Si利用類內(nèi)離散矩陣求總類內(nèi)離散矩陣Sw求最佳投影方向Wo定義閾值,并求得分界面2、感知準(zhǔn)則函數(shù)分類器:獲得增廣樣本向量和初始增廣權(quán)向量對(duì)樣

3、本進(jìn)行規(guī)范化處理獲得解區(qū),并用權(quán)向量迭代修正錯(cuò)分樣本集,得到最終解區(qū)五、實(shí)驗(yàn)結(jié)果:1、fisher線性判決分類器:條件:取pw1=pw2=0.5,閾值系數(shù)為0.5廠賃訪巳謖性判決A.第一種情況B.第二種情況2、感知準(zhǔn)則函數(shù)判決:條件:取步長(zhǎng)row為1感知準(zhǔn)則判決感知誰(shuí)則判決結(jié)果:六、結(jié)果分析:1、fisher線性判決器中,調(diào)整閾值系數(shù)時(shí),分界面會(huì)隨之平行上下移動(dòng),通過調(diào)整閾值系數(shù)的大小,就能比較合理的得到分界面。而投影方向不會(huì)隨閾值系數(shù)的變化而變化。2、fisher線性判決器中,由于題目中樣本數(shù)目少,所以其先驗(yàn)概率統(tǒng)一取為0.5。而改變其先驗(yàn)概率對(duì)結(jié)果的影響不是很大。3、感知準(zhǔn)則函數(shù)分類判決中

4、,調(diào)整步長(zhǎng)row的大小可使分界面的方向和位置發(fā)生變動(dòng),但是變動(dòng)范圍不大,僅限于小范圍的調(diào)整。七、源程序functionvarargout=fisherganzhi(varargin)gui_Singleton=1;gui_State=struct(gui_Name,mfilename,.gui_Singleton,gui_Singleton,.gui_OpeningFcn,fisherganzhi_OpeningFcn,.gui_OutputFcn,fisherganzhi_OutputFcn,.gui_LayoutFcn,.gui_Callback,);ifnargin&ischar(var

5、argin1)gui_State.gui_Callback=str2func(varargin1);endifnargoutvarargout1:nargout=gui_mainfcn(gui_State,varargin:);elsegui_mainfcn(gui_State,varargin:);end%-Executesjustbeforefisherganzhiismadevisible.functionfisherganzhi_OpeningFcn(hObject,eventdata,handles,varargin)handles.output=hObject;%Updatehan

6、dlesstructureguidata(hObject,handles);%-Outputsfromthisfunctionarereturnedtothecommandline.functionvarargout=fisherganzhi_OutputFcn(hObject,eventdata,handles)varargout1=handles.output;%-Executesonbuttonpressinpushbutton2.functionpushbutton2_Callback(hObject,eventdata,handles)pw1=str2num(get(handles.

7、edit1,String);pw2=str2num(get(handles.edit2,String);k=str2num(get(handles.edit3,String);w1=11;20;21;02;13;w2=-12;00;-10;-1-1;0-2;u1=mean(w1);u2=mean(w2);s1=zeros(2,2);s2=zeros(2,2);forn=1:length(w1)s1=s1+(w1(n,:)-u1)*(w1(n,:)-u1);end;form=1:length(w2)s2=s2+(w2(m,:)-u2)*(w2(m,:)-u2);end;sw=pw1*s1+pw2

8、*s2;wo=inv(sw)*(u1-u2);y0=k*(wo*u1+wo*u2);x1=-4:0.3:6;x2=(y0-wo(1)*x1)/wo(2);x3=wo(2)*x1/wo(1);cla(handles.axes1);axes(handles.axes1);holdon;plot(x1,x2,b,x1,x3,k);plot(w1(:,2),w1(:,1),*r);plot(w2(:,2),w2(:,1),og);title(Fisher線性分類器(2);12);handles)text(3.5,13,*表示第1類,FontSize,10,Color,rtext(3.5,11,o表示第

9、2類,FontSize,10,Color,gtext(wo(1),wo(2),leftarrow投影方向,FontSizeholdoff;%-Executesonbuttonpressinpushbutton1.functionpushbutton1_Callback(hObject,eventdata,pw1=str2num(get(handles.edit1,String);pw2=str2num(get(handles.edit2,String);k=str2num(get(handles.edit3,String);w1=20;22;24;33;w2=03;-22;-1-1;1-2;3

10、-1;u1=mean(w1);u2=mean(w2);s1=zeros(2,2);s2=zeros(2,2);forn=1:length(w1)s1=s1+(w1(n,:)-u1)*(w1(n,:)-u1);end;form=1:length(w2)s2=s2+(w2(m,:)-u2)*(w2(m,:)-u2);end;sw=pw1*s1+pw2*s2;wo=inv(sw)*(u1-u2);y0=k*(wo*u1+wo*u2);x1=-4:0.3:6;x2=(y0-wo(1)*x1)/wo(2);x3=wo(2)*x1/wo(1);cla(handles.axes1);axes(handles

11、.axes1);holdon;plot(x1,x2,b,x1,x3,k);plot(w1(:,2),w1(:,1),*r);plot(w2(:,2),w2(:,1),og);title(Fisher線性分類器(2);text(3.5,9,*表示第1類,FontSize,10,Color,r);text(3.5,8,o表示第2類,FontSize,10,Color,g);text(wo(1),wo(2),leftarrow投影方向,FontSize,12);holdoff;functionedit3_Callback(hObject,eventdata,handles)%-Executesdur

12、ingobjectcreation,aftersettingallproperties.functionedit3_CreateFcn(hObject,eventdata,handles)ifispc&isequal(get(hObject,BackgroundColor),get(0,defaultUicontrolBackgroundColor)set(hObject,BackgroundColor,white);endfunctionedit2_Callback(hObject,eventdata,handles)%-Executesduringobjectcreation,afters

13、ettingallproperties.functionedit2_CreateFcn(hObject,eventdata,handles)ifispc&isequal(get(hObject,BackgroundColor),get(0,defaultUicontrolBackgroundColor)set(hObject,BackgroundColor,white);endfunctionedit1_Callback(hObject,eventdata,handles)functionedit1_CreateFcn(hObject,eventdata,handles)ifispc&iseq

14、ual(get(hObject,BackgroundColor),get(0,defaultUicontrolBackgroundColor)set(hObject,BackgroundColor,white);end%-Executesonbuttonpressinpushbutton3.functionpushbutton3_Callback(hObject,eventdata,handles)row=str2num(get(handles.edit4,String);w1=11;20;21;02;13;w2=-12;00;-10;-1-1;0-2;y1=ones(1,5);w1;y2=-

15、ones(1,5);w2;w=y1y2;v=y1(:,1);sumz=zeros(3,1);z=ones(1,10);whilesum(z)0v=v+row*sumz;h=v*w;z=(abs(h)h);Z=w.*z;z;z;sumz=sum(Z);endx1=-2:0.5:2.5;x2=(-v(1)-v(2)*x1)/v(3);cla(handles.axes1);axes(handles.axes1);holdon;plot(x1,x2);plot(w1(1,:),w1(2,:),*r)plot(w2(1,:),w2(2,:),og)title(感知準(zhǔn)則函數(shù)分類器);text(1.5,5,

16、*表示第1類,FontSize,10,Color,r);text(1.5,4,o表示第2類,FontSize,10,Color,g)holdoff;functionedit4_Callback(hObject,eventdata,handles)%hObjecthandletoedit4(seeGCBO)%eventdatareservedtobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:get(hObject,String)returnscontentsofedit4astext%str2double(get(hObject,String)returnscontentsofedit4asadouble%-Executesduringobjectcreation,aftersettingallproperties.functionedit4_CreateFcn(hObject,eventdata,handles)%hObjecthandletoedit4(seeGCBO)%eventdatareserved-tobedefinedinafutureversi

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝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ù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 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ì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論