FAFU機器學習10-2 ANN課件_第1頁
FAFU機器學習10-2 ANN課件_第2頁
FAFU機器學習10-2 ANN課件_第3頁
FAFU機器學習10-2 ANN課件_第4頁
FAFU機器學習10-2 ANN課件_第5頁
已閱讀5頁,還剩33頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

FoundationsofMachineLearning

ArtificialNeuralNetworks2023/11/4ArtificialNeuralNetworksLesson10-1ArtificialNeuralNetworksArtificialNeuralNetworks:IntroductionSingleLayerNeuralNetworksMultipleLayerNeuralNetworksSelf-OrganizingMap(SOM)OtherNeuralNetworkssklearn.neural_network2023/11/4ArtificialNeuralNetworksLesson10-2ArtificialNeuralNetworks:IntroductionThebrainandtheneurons(腦與神經元)NeuronsarethebuildingblocksofthebrainTheirinterconnectivityformstheprogrammingthatallowsustosolvealloureverydaytasksTheyareabletoperformparallelandfaulttolerantcomputationTheoreticalmodelsofhowtheneuronsinthebrainworkandhowtheylearnhavebeendevelopedfromthebeginningofArtificialIntelligenceMostofthesemodelsarereallysimple(butyetpowerful)andhaveaslimresemblancetorealbrainneurons2023/11/4ArtificialNeuralNetworksLesson10-3ArtificialNeuralNetworks:IntroductionAneuronmodel(神經元模型)1943年,[McCullochandPitts,1943]抽象出“M-P神經元模型”,在這個模型中,神經元接收到來自n個其他神經元傳遞過來的輸入信號,這些輸入信號通過帶權重的連接(connection)進行傳遞,神經元接收到的總輸入值將與神經元的閾值進行比較,然后通過“激活函數(shù)”(activationfunction)處理以產生神經元的輸出。2023/11/4ArtificialNeuralNetworksLesson10-4ArtificialNeuralNetworks:Introduction理想中的激活函數(shù)是階躍函數(shù),它將輸入值映射為輸出值“0”或者“1”,顯然“1”對應于神經元興奮,“0”對應于神經元抑制。然而,階躍函數(shù)具有不連續(xù)、不光滑等不太好的性質,因此實際常用Sigmoid作為激活函數(shù),它把可能在較大范圍內變化的輸入值擠壓到(0,

1)輸出值范圍內,因此有時也稱為"擠壓函數(shù)"(squashingfunction).2023/11/4ArtificialNeuralNetworksLesson10-5ArtificialNeuralNetworks:IntroductionOrganizationofneurons/Networks,神經元組織/網絡Usuallyneuronsareinterconnectedformingnetworks,therearebasicallytwoarchitecturesFeedforwardnetworks(前饋網絡),neuronsareconnectedonlyinonedirectionRecurrentnetworks(遞歸網絡,或者循環(huán)網絡),outputscanbeconnectedtotheinputsFeedforwardnetworksareorganizedinlayers,oneconnectedtotheotherSinglelayerneuralnetworks(perceptronnetworks,感知器網絡):inputlayer(輸入層),outputlayer(輸出層)Multiplelayerneuralnetworks:inputlayer,hiddenlayers(隱層),outputlayer2023/11/4ArtificialNeuralNetworksLesson10-6ArtificialNeuralNetworks:IntroductionNeuronsaslogicgates(神經元作為邏輯門)InitialresearchinANNdefinedneuronsasfunctionscapableofemulatelogicgates(Thresholdlogicalunits,TLU,閾值邏輯單元)Inputsxi

∈{0,1},weightswi

∈{+1,?1},thresholdw0

∈R,activationfunction?thresholdfunction:g(x)=1ifx≥w0,0otherwiseSetsofneuronscancomputeBooleanfunctionscomposingTLUsthatcomputeOR,ANDandNOTfunctions2023/11/4ArtificialNeuralNetworksLesson10-7ArtificialNeuralNetworks:IntroductionNeuronsaslogicgates(神經元作為邏輯門)

2023/11/4ArtificialNeuralNetworksLesson10-8ArtificialNeuralNetworksArtificialNeuralNetworks:IntroductionSingleLayerNeuralNetworksMultipleLayerNeuralNetworksSelf-OrganizingMap(SOM)OtherNeuralNetworkssklearn.neural_network2023/11/4ArtificialNeuralNetworksLesson10-9SingleLayerNeuralNetworksTheperceptron(感知機)感知機(Perceptron)由兩層神經元組成,輸入層接收外界輸入信號后傳遞給輸出層,輸出層是M-P神經元。2023/11/4ArtificialNeuralNetworksLesson10-10SingleLayerNeuralNetworksTheperceptron(感知機)感知機(Perceptron)由兩層神經元組成,輸入層接收外界輸入信號后傳遞給輸出層,輸出層是M-P神經元。2023/11/4ArtificialNeuralNetworksLesson10-11SingleLayerNeuralNetworksTheperceptron(感知機)Theperceptronlearningrule(感知器學習規(guī)則)感知機學習規(guī)則非常簡單,對訓練樣例(x,y),若當前感知機的輸出為y’,則感知機權重將這樣調整:wi=wi+?wi?wi=η(y?y’)xi其中η屬于(0,1)為學習率(learningrate)2023/11/4ArtificialNeuralNetworksLesson10-12SingleLayerNeuralNetworksLimitationsoflinearperceptrons(線性感知器的不足)WithlinearperceptronswecanonlyclassifycorrectlylinearlyseparableproblemsThehypothesisspaceisnotpowerfulenoughforrealproblemsExample,theXORfunction:2023/11/4ArtificialNeuralNetworksLesson10-13ArtificialNeuralNetworksArtificialNeuralNetworks:IntroductionSingleLayerNeuralNetworksMultipleLayerNeuralNetworks(多層神經網絡)Self-OrganizingMap(SOM)OtherNeuralNetworkssklearn.neural_network2023/11/4ArtificialNeuralNetworksLesson10-14MultipleLayerNeuralNetworksMultilayerPerceptron要解決非線性可分問題,需考慮使用多層功能神經元,比如對異或問題:2023/11/4ArtificialNeuralNetworksLesson10-15MultipleLayerNeuralNetworksMultilayerPerceptron一般地,多層神經網絡中每層神經元與下層神經元全互連,神經元之間不存在同層連接,也不存在跨層連接,這樣的神經網絡結構通常稱為“多層前饋神經網絡”(multi-layerfeedforwardneuralnetworks)。其中輸入層神經元接收外界輸入,隱層與輸出層神經元對信號進行加工,最終結果由輸出層神經元輸出。換言之,輸入層神經元僅是接受輸入,不進行函數(shù)處理,隱層與輸出層包含功能神經元。2023/11/4ArtificialNeuralNetworksLesson10-16MultipleLayerNeuralNetworksLearningMultilayerNetworks(多層網絡的學習)InthecaseofsinglelayernetworkstheparameterstolearnaretheweightsofonlyonelayerInthemultilayercasewehaveasetofparametersforeachlayerandeachlayerisfullyconnectedtothenextlayerForsinglelayernetworkswhenwehavemultipleoutputswecanlearneachoutputseparatelyInthecaseofmultilayernetworksthedifferentoutputsareinterconnected2023/11/4ArtificialNeuralNetworksLesson10-17MultipleLayerNeuralNetworksBackPropagation(反向傳播)–IntuitivelyTheerrorofthesinglelayerperceptronlinksdirectlythetransformationoftheinputintheoutputInthecaseofmultiplelayerseachlayerhasitsownerrorTheerroroftheoutputlayerisdirectlytheerrorcomputedfromthetruevaluesTheerrorforthehiddenlayersismoredifficulttodefineTheideaistousetheerrorofthenextlayertoinfluencetheweightsofthepreviouslayerWearepropagatingbackwardstheoutputerror,hencethenameofBackPropagation(BP)2023/11/4ArtificialNeuralNetworksLesson10-18MultipleLayerNeuralNetworksBackPropagation(反向傳播)–IntuitivelyTheideaistousetheerrorofthenextlayertoinfluencetheweightsofthepreviouslayer2023/11/4ArtificialNeuralNetworksLesson10-19MultipleLayerNeuralNetworksBackpropagation–Algorithm(BP算法)ThebackpropagationalgorithmworksintwostepsPropagatetheexamplesthroughthenetworktoobtaintheoutput(forwardpropagation)Propagatetheoutputerrorlayerbylayerupdatingtheweightsoftheneurons(backpropagation)2023/11/4ArtificialNeuralNetworksLesson10-20MultipleLayerNeuralNetworksBackpropagation–Algorithm(BP算法)ThebackpropagationalgorithmworksintwostepsPropagatetheexamplesthroughthenetworktoobtaintheoutput(forwardpropagation)Propagatetheoutputerrorlayerbylayerupdatingtheweightsoftheneurons(backpropagation)BP算法基于梯度下降(gradientdescent)策略,以目標的負梯度方向對參數(shù)進行調整。Sigmoid函數(shù)2023/11/4ArtificialNeuralNetworksLesson10-21MultipleLayerNeuralNetworks多層前饋神經網絡學習的目標是均方誤差,對(xk,yk)2023/11/4ArtificialNeuralNetworksLesson10-22MultipleLayerNeuralNetworksBP算法基本流程2023/11/4ArtificialNeuralNetworksLesson10-23輸入:訓練集D={(xk,yk)},k=l…m;學習率η.過程:1:在(0,

1)范固內隨機初始化網絡中所有連接權和閾值2:repeat3:forall(xk

,yk)inDdo4:

根據(jù)當前參數(shù)計算當前樣本的輸出5:

計算輸出層神經元的梯度項;6:

計算隱層神經元的梯度項;7:

更新連接權whj

和vih,更新輸出層閾值θj和隱層閾值γh8:endfor9:until達到停止條件輸出:連接權與閾值確定的多層前饋神經網絡ArtificialNeuralNetworksArtificialNeuralNetworks:IntroductionSingleLayerNeuralNetworksMultipleLayerNeuralNetworksSelf-OrganizingMap(SOM),自組織映射OtherNeuralNetworkssklearn.neural_network2023/11/4ArtificialNeuralNetworksLesson10-24Self-OrganizingMapTheSelf-OrganizingMapisoneofthemostpopularneuralnetworkmodels.Itbelongstothecategoryofcompetitivelearningnetworks(競爭學習型網絡).TheSelf-OrganizingMapisbasedonunsupervisedlearning(無監(jiān)督學習),whichmeansthatnohumaninterventionisneededduringthelearningandthatlittleneedstobeknownaboutthecharacteristicsoftheinputdata.Wecould,forexample,usetheSOMforclusteringdatawithoutknowingtheclassmembershipsoftheinputdata.TheSOMcanbeusedtodetectfeaturesinherenttotheproblemandthushasalsobeencalledSOFM,theSelf-OrganizingFeatureMap.2023/11/4ArtificialNeuralNetworksLesson10-25SOM典型結構SOM網絡是一種競爭學習型的無監(jiān)督神經網絡,將高維空間中相似的樣本點映射到網絡輸出層中的鄰近神經元。典型SOM網絡共有兩層,輸入層模擬感知外界輸入信息的視網膜,輸出層模擬做出響應的大腦皮層。2023/11/4ArtificialNeuralNetworksLesson10-26SOM網絡學習算法訓練過程簡述:在接收到訓練樣本后,每個輸出層神經元會計算該樣本與自身攜帶的權向量之間的距離,距離最近的神經元成為競爭獲勝者,稱為最佳匹配單元。然后最佳匹配單元及其鄰近的神經元的權向量將被調整,以使得這些權向量與當前輸入樣本的距離縮小。這個過程不斷迭代,直至收斂。輸入層:假設一個輸入樣本為x=[x1,x2,x3,…,xn],是一個n維向量,則輸入層神經元個數(shù)為n個。輸出層(競爭層):通常輸出層的神經元以矩陣等拓撲結構排列在二維空間中,每個神經元都有一個權值向量。假設輸出層有m個神經元,則有m個權值向量,Wi=[wi1,wi2,....,win],1<=i<=m。2023/11/4ArtificialNeuralNetworksLesson10-27SOM網絡學習算法流程1.初始化:權值使用較小的隨機值進行初始化,并對輸入向量和權值做歸一化處理X‘=X/||X||,

ω’i=ωi/||ωi||,1<=i<=m,||X||和||ωi||分別為輸入的樣本向量和權值向量的歐幾里得范數(shù)。2.將樣本輸入網絡:樣本與權值向量做點積,點積值最大的輸出神經元贏得競爭,(或者計算樣本與權值向量的歐幾里得距離,距離最小的神經元贏得競爭)記為獲勝神經元。3.更新權值:對獲勝的神經元拓撲鄰域內的神經元進行更新,并對學習后的權值重新歸一化。4.更新學習速率η及拓撲鄰域N,N隨時間增大距離變小。5.判斷是否收斂。如果學習率η<=ηmin或達到預設的迭代次數(shù),結束算法,否則,返回第2步。2023/11/4ArtificialNeuralNetworksLesson10-28SOM網絡學習算法流程1.初始化權值,并對輸入向量和權值做歸一化處理2.將樣本輸入網絡,尋找獲勝神經元。3.更新權值:對獲勝的神經元拓撲鄰域內的神經元進行更新,并對學習后的權值重新歸一化。

ω(t+1)=ω(t)+η(t,n)*(x-ω(t))

η(t,n):η為學習率,是關于訓練時間t和與獲勝神經元的拓撲距離n的函數(shù)。

η(t,n)=η(t)e-n4.更新學習速率η及拓撲鄰域N,N隨時間增大距離變小。5.判斷是否收斂。如果學習率η<=ηmin或達到預設的迭代次數(shù),結束算法,否則,返回第2步。2023/11/4ArtificialNeuralNetworksLesson10-29SOM網絡學習算法流程1.初始化權值,并對輸入向量和權值做歸一化處理2.將樣本輸入網絡,尋找獲勝神經元。3.更新權值:對獲勝的神經元拓撲鄰域內的神經元進行更新,并對學習后的權值重新歸一化。

ω(t+1)=ω(t)+η(t,n)*(x-ω(t))

η(t,n):η為學習率,是關于訓練時間t和與獲勝神經元的拓撲距離n的函數(shù)。

η(t,n)=η(t)e-n4.更新學習速率η及拓撲鄰域N,N隨時間增大距離變小。5.判斷是否收斂。如果學習率η<=ηmin或達到預設的迭代次數(shù),結束算法,否則,返回第2步。2023/11/4ArtificialNeuralNetworksLesson10-30ArtificialNeuralNetworksArtificialNeuralNetworks:IntroductionSingleLayerNeuralNetworksMultipleLayerNeuralNetworksSelf-OrganizingMap(SOM),自組織映射OtherNeuralNetworkssklearn.neural_network2023/11/4ArtificialNeuralNetworksLesson10-31OtherNeuralNetworksRBF網絡RBF(RadialBasisFunction,徑向基函數(shù))網絡是一種單隱層前饋神經網絡,它使用徑向基函數(shù)作為隱層神經元激活函數(shù),而輸出層則是對隱層神經元輸出的線性組合.假定輸入為d維向量x,輸出為實值,

則RBF網絡可表示為:常用的高斯徑向基函數(shù)形如:2023/11/4ArtificialNeuralNetworksLesson10-32OtherNeuralNetworksRBF網絡受限玻爾茲曼機,RestrictedBoltzmannmachines(RBM)RBM是由Hinton和Sejnowski于1986年提出的一種生成式隨機神經網絡(generativestochasticneuralnetwork),該網絡由一些可見單元(visibleunit,對應可見變量,亦即數(shù)據(jù)樣本)和一些隱藏單元(hiddenunit,對應隱藏變量)構成,可見變量和隱藏變量都是二元變量,亦即其狀態(tài)取{0,1}。整個網絡是一個二部圖,只有可見單元和隱藏單元之間才會存在邊,可見單元之間以及隱藏單元之間都不會有邊連接2023/11/4ArtificialNeuralNetworksLesson10-33OtherNeuralNetworksRBF網絡受限玻爾茲曼機RBMareunsupervisednonlinearfeaturelearnersbasedonaprobabilisticmodel.ThefeaturesextractedbyanRBMorahierarchyofRBMsoftengivegoodresultswhenfedintoalinearclassifiersuchasalinearSVMoraperceptronRBM中的神經元都是布爾型的,即只能取0、1兩種狀態(tài).狀態(tài)1表示激活,狀態(tài)0表示抑制.令向量s

屬于{0,l}n

表幣n個神經元的狀態(tài),ωij

表示神經元i與j

之間的連接權,θi也表示神經元i

的閾值,則狀態(tài)向量s

所對應的Boltzmann機能量定義為:2023/11/4ArtificialNeuralNetworksLesson10-34ArtificialNeuralNetworksArtificialNeuralNetworks:IntroductionSingleLayerNeuralNetworksMultip

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論