AI建模師-素養(yǎng)手冊(7)-把專家直覺納入AI的實踐篇_第1頁
AI建模師-素養(yǎng)手冊(7)-把專家直覺納入AI的實踐篇_第2頁
AI建模師-素養(yǎng)手冊(7)-把專家直覺納入AI的實踐篇_第3頁
AI建模師-素養(yǎng)手冊(7)-把專家直覺納入AI的實踐篇_第4頁
AI建模師-素養(yǎng)手冊(7)-把專家直覺納入AI的實踐篇_第5頁
已閱讀5頁,還剩114頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

目錄1.前言2.范例(一):工廠機器的維修判斷3.范例(二):醫(yī)院護理師排班4.護理師排班的實踐代碼、"__1—月I」言-在上一集(第6集)里,舉了兩個專家直覺的范例,一個是工廠里機器的維修判斷。另一個范例是醫(yī)院護理師的排班。-不過,在上一集里,您只看到ExceI畫面的操作,以及所輸入的數(shù)據(jù)和輸出的結果。-也許您會很好奇,這Excel背后的Python程序是如何實現(xiàn)的昵?-那么,本集就來演示一下這幕后的程序碼。其中使用了TensorFIow框架(Framework)。***本文摘自高煥堂的下列書籍******以及北京【電子世界雜志】連載專欄***ChatGPT的啟示-ChatGPT的能力很驚人,但它仍是縱橫江湖的野貓,而非真正貼心的〈家貓〉。-ChatGPT的表現(xiàn)讓人驚艷,但它仍是位創(chuàng)新組合食材的炒飯快手,還需搭配您自己的素材,才真正創(chuàng)新大廚師。-在ChatGPT上想搭配您自己的食材,可行途徑之一是:您自己建立中小格局的AI模型,輸入您的素材,您自已訓練該模型,訓練出〈潛藏空間向量〉,然后將它(向量),融合進去ChatGPT的潛藏空間里。-所以,逐漸地家家戶戶都將需要〈AI建模師〉來建模、訓練,然后融合成有咼度智慧的AI家貓。-許多人對于機器學習,常常只關注于〈訓練數(shù)據(jù)>與<算法>,然后就是〈輸出結果〉;而沒意會到:數(shù)據(jù)只是〈沙子>,經(jīng)由模型的淬煉才成為〈金子〉,再經(jīng)由模型鑄造才做出漂亮〈金飾〉。-其中,〈金子〉才是關鍵性的素材。不同素材的創(chuàng)新組合,并貼心依據(jù)個人的心意(Attension)而調(diào)整和修飾,才是今天ChatGPT的真諦,才是GreatPoint(GPT)。-金子在哪里,就藏在人們無法理解的桃花源里,就是潛藏空間(LatentSpace),又稱為:隱藏空間或隱空間。-金子在哪里,就藏在人們無法理解的桃花源里,就是潛藏空間(LatentSpace),又稱為:隱藏空間或隱空間。I范例:專家直覺-在一個工廠里,有一部機器天天運作中,它會處于3種狀態(tài)之―,分別以RGB顏色代表之。如下圖:()范例:專家直覺-每天中午12:00記錄其當天狀態(tài)。當其狀態(tài)為順時鐘、或反時鐘變化,屬于正常變化。如下圖:正常變化)正常變化)詳細說明:一部機器會處于3種狀態(tài),分別以RGB顏色代表之。每天

中午12:00記錄其當天狀態(tài)。當其狀態(tài)為順時鐘、或反時鐘變化,屬于正常變化;否則為異常變化(跳機)。如果出現(xiàn)〈連續(xù)異常變化〉就必須停機檢修。異常變化O范例:專家直覺-否其中值得留意的是,依據(jù)工廠的機器管理準則:如果出現(xiàn)〈連續(xù)異常變化(跳機)〉就必須停機檢修。-現(xiàn)在,我們就來看看過去一周(工作6天)以來,這部機器狀態(tài)紀錄數(shù)據(jù),如下:I范例:專家直覺-有一位負責檢視機器狀態(tài)的老師傅來了,他一眼就能看出了這部機器,在過去一周(工作6天)里并沒有出現(xiàn)〈連續(xù)異常變化(跳機)〉的現(xiàn)象。?所以不必須停機檢修。-那么AI是否也能瞬間看出來呢?范例:Al來學習專家直覺-茲把這些數(shù)據(jù)呈現(xiàn)于Exce1表格里,如下圖:I范例:Al來學習專家直覺-運用專家直覺,把它表達于卷積核里:給予的百例:Al來學習專家直覺-請按下〈卷積〉,就拿K0[]和K1[]卷積核來對X[]進行卷積運算,得到Y0[]:范例:Al來學習專家直覺-從上圖里的Y0[]就可以看出來了:有一個值達到510,代表發(fā)現(xiàn)一次異常(跳機)現(xiàn)象,從紅色狀態(tài)跳到藍色。-同理,從Y1[]可以看出來:有一個值是達到510,代表發(fā)現(xiàn)一次異常(跳機)現(xiàn)象,從藍色跳到紅色。范例:Al來學習專家直覺?接下來,請按下〈相加〉。把K0[]所提取的特征(即Y0)與K1[]所提取的特征(即Y1),合并起來。例如,把Y0[]和Y1[]的對應元素進行V兩兩相加〉計算,而得到z[]°?從Z[]可以看出來:在本周里總共跳機2次。I范例:Al來學習專家直覺-人類專家一眼就看得出來:本周沒有發(fā)生〈連續(xù)兩天跳機>的現(xiàn)象。?那么,AI是否也能一眼看出來呢?-答案是:可以的。?剛才由兩個卷積核:K0[]和kl[]去進行卷積運算(自動提取特征),分別看到了一次跳機現(xiàn)象。但是如何看出來是否V連續(xù)跳機〉呢?答案是:再進行一次特征提?。ň矸e)就可以看出來了。范例:專家直覺?再一次使用卷積核,如下圖:I范例:Al來學習專家直覺?接下來,請按下〈卷積〉。就拿KZ[]卷積核來對Z[]進行卷積運算,得到YZ[],就可以看出來了。范例:Al來學習專家直覺?請看看Python程序,來實踐上述的情境。范例:Al來學習專家直覺kO=np.array([1,kl=npfarrayt[0,yO=conv(x,kOf3)piint("\nYD=",np,round(yO,2))yl=Conv(x,k1,3)print("\nYl=",np,round(yl,2))z=np.zeros((yO.size),dtype='int32()far1inrange(yO.Size):z[i]=y0[i]+yl[i]printC'VnZ=”,z)kz=np.array([1,1])yz=conv(z,kz,1)print("\nYZ=",yz)#............ContInued--------------------x=np.array([255,0,0,0,0.255,0,255,。,255,0,0,0,255,01)0,0.255.專家直接給卷積核KO和Kl___________丿-卷積核的W,直接從專家心中來。^1/]]1OQOD-1O1OO_______________范例:Al來學習專家直覺?卷積核的w,直接從專家心中來。#............ContInued.............................x=np.array([255,0,0,0,0,255,0,255,丄0,0,255.255,0,0,0,255,0])k0=np.array([1,0,□,0,Q,1])kl=np.array([0?0,I,1,0,0])yO=conv(x,

kOf3)print("\nY0=H,np,round(yO,2))yl=Conv(x,k1,3)print("\nYl=",np,round(yl,2))z

=npnzeros((yO,size),dtype='int32')fciriinrange(yD.SIze):z[i]=y0[i]+yl[i]printfAnZ=”,z)kz=np.array([1,1])yz=conv(z,

kz,1)print("\nYZ=\ys)#End____________________拿KO去卷積____________________范例:Al來學習專家直覺kO=np.array([1,kl=npfarrayt[0,yO=conv(x,kOf3)piint("\nYD=",np,round(yO,2))#............ContInued--------------------x=np.array([255,0,0,0,0.255,0,255,。,255,0,0,0,255,01)0,0,255,print("\nYZ=",yz)kz=np.array([1,1])yz=conv(z,kz,I)z=np.zeros((yO.size),dtype='int32')far1inrange(yO.Size):z[i]=y0[i]+yl[i]printC'VnZ=”,z)y1=Conv(x,k1,3)print("\nYlnp,round(yL2))拿Kl去卷積-卷積核的W,直接從專家心中來。]]loQoD-1o1oo_______________范例:Al來學習專家直覺kO=np.array([1,kl=np.array([0,#............ContInued--------------------..............................x=np.array([255,0,0,0,0.255,0,255,。,255,0,0,0,255,01)____________________________________yO=conv(x,k。,____________prmt(F,\nYlJ=",np,round(yU,27J_________________________________________Iyl=Conv(x,kl,3)0,0,255,primei=*,np,round(yl,ZTJprint("\nYZ=\yz)kz=np.array([1,1])yz=conv(z,kz,I)z=npnzeros((yO,size),dtype='int32')fciriinrange(yD.SIze):z[i]=y0[i]+yl[i]printC'VnZ=”,z)___yO特征表[FeatureMap)____________________________汰_丿______________yl特征表(FeatureMap)____________丿-卷積核的w,直接從專家心中來。^1/]]1OQOD-1O1OOkO=np.array([1,kl=npfarrayt[0,yl=Conv(x,k1,3)print("\nYl=",np,round(yl,2))yO=conv(x,kOf3)piint("\nYD=",np,round(yO,2))范例:Al來學習專家直覺?卷積核的w,直接從專家心中來。Continuedx=np.array([255,0,0,0,0,255,0,255,丄0,0,255,255,0,0,0,255,01)z=npnzeros((yO,size),dtype='int32,)fciriinrange(yD.SIze):z[i]=y0[i]+yl[i]printfAnZ=”,z)將兩個特征表相加______________丿kz=np.array([1,1])yz=conv(z,kz,1)print("\nYZ=",yz)]]loQoD-1o1oo_______________范例:Al來學習專家直覺kO=np.array([1,kl=npfarrayt[0,kz=np.array([1,1])yz=conv(z,

izrI)______________________________________________yO=conv(x,

kOf3)print("\nY0=H,np,round(yO,2))______________________yl=Conv(x,k1,3)print("\nYl=",np,round(yl,2))z=npnzeros((yO,size),dtype='int32')fciriinrange(yD.SIze):z[i]=y0[i]+yl[i]printfAnZ=”,z)_________________________________________print("\nYZ=\yz)______再一次卷積___________丿-卷積核的W,直接從專家心中來。#............ContInued.............................x=np.array([255,0,0,0,0,255,0,255,丄0,0,255.255,0,0,0,255,01)]]loQoD-1o1ooYO=[51002550255]Y1=[025505100]Z=[510255255510255]YZ=[765510765765]?>兩個特征表Y0=[51002550255]Y1=[025505100]Z=[510255255510255]YZ=[765510765765]?>丿YO=[51002550255]Y1=[025505100]Z=[510255255510255]YZ=[765510765765]?>特征表相加丿-發(fā)現(xiàn)了2次跳機YO=[51002550255]Z=Y1=[025505100]匝)255255(510)255]YZ=[765510765765]?>YO=[51002550255]Y1=[025505100]Z=[510255255510255]-YZ□都小于1020,沒有〈連續(xù)跳機〉的現(xiàn)象Y0=[51002550255]Y1=[025505100]Z=[510255255510255]YZ=「7655107657651?>最后的卷積表專家只提供直覺判斷范例:Al來學習專家直覺-設計一個分類器,來吸納專家智慧ABCDEFGHIJKLMN0126RGBRGBTZ3紅2550002550綠0(沒問題)4S6綠0255000255藍0(沒問題)5藍0025502550綠0(沒問題)6Epoch500綠0255025500紅0(沒問題)7紅2550000255藍_1(跳機)8藍0025525500紅1(跳機)910111213141516Initial學習EpochInitial學習正規(guī)化機臺的各種狀態(tài)變化(沒問題)(沒問題)(沒問題)(沒問題)ABCDEFGHIJKLM.N0126RGBRGBTTZ3紅2550002550綠0(沒問題)4S6綠0255000255藍0(沒問題)5藍0025502550綠0(沒問題)6Epoch500綠0255025500紅0(沒問題)7紅2550000255藍_1(跳機)8藍0025525500紅1(跳機)91011Initial12范例:Al來學習專家直覺-正規(guī)化ABCDEFGHIJKLMN126RGBRGBT3紅100010綠0(沒問題)4s6綠010001藍0(沒問題)5藍001010綠0(沒問題)6Epoch500綠010100紅0(沒問題)7紅100001藍_1(跳機)8藍001100紅1(跳機)91011Initial120Z17范例:Al來學習專家直覺-展幵訓練ABCDEHJKLMNO1N6TZ2(沒問題)00.03(沒問題)S600.034(沒問題)00.035(沒問題)Epoch50000.036(跳機)10.977(跳機)10.97891011Initial1213W-5.211.741.6-5.341.614正規(guī)化B1516x0xlx2藍紅藍紅遷移到卷積核1.740RGBRGB紅100010綠010001藍001010綠010100紅100001藍001100第1天第2天第3天第4天第5天第6天00002550255000255255000255W1.74-5.211.741.65341.6第1天第2天第3天第4天第5天第6天255000255第1天第2天第3天第4天第5天第6天255000255ATX[]00002550255001.6QRs第6天EFG第2天12KLM第4天NOP第5天BCD第1天HIJ第3天z255J56J_8Ar'255000--tT"二_——w1.74「5211.741.6P-5.34B0請看看Python程序,來實踐上述的情境。#ex_All_04.pyimportiiiiiiipy;技】項importkurasfLik?iil:,iiiudE!1siipui'

記qu日ritialfro/iikeras.layersimportDensefromkeras.optionizersimpo11SGDfromkeras.modelsijiiportMod&ldefsigmoid(y):return1/(1+np.6xp(-y))1,dtype=np.f1Bl132)丿準備分類器的訓練數(shù)據(jù)t=np.array([[0],[0],[0],[0],[1],[1]],dtypNnp,f1oat32)...........Continued......................................EditFormatRunOptionsWindowHelp05005]525025>50o505?22?o?>55o02020050055505505?5?72o2?o55ff.f200020np請看看Python程序,來實踐上述的情境。Continued建立分類器模型d.$at_w日ights(wb)i=

Dense(0,activation=1

si^moid'?

name="dM

,

input_di葉”model=Sequentia1()modelpadd(d)modelnCDinpilet1dss=keras.losses.MSE,optimizer=SGD(1r=0.15),metrics=['accuracy'])wb=[tip,array([[0.5],[-0.5],[0.5],[04],[-04],[04]],dtype=np.fLoat32),np.ariay([0.0],dtyp&=np,float32)]kkw=Nuiiekkb=Mone#...........continued...............................6£-!______-=--訓練分類器wo=d.g日t_weights()[0]kkw=】項,£qiMPZ:頃WQ)print(n\n-----training-----*')printf=‘,np^roundtwo,2))bo=d.^et_weights()[1]kkb=】項,阪旺莢頃bo)print(ll\nB=11,np.round(bo,2))y=npdot(x,kkw)+kkbz

=sigMoid(y)Print("\nZ=",np.round(zt2))|#...........coniinued.............................*...........coniinued......................defone_ruiiiid(x,t):globalmodeldxx=xriptiEwaxis,::dtt=tjnp,newaxis,二model.fit(dtt,1,1,D,stuffle=False)deftiainir^():globalmoiel,

kkw,kkbX=DX/255forepir;r;in^&(2000):for1inrange(S)ioneround(x[i],t[i])im~i=1.gwt^urwi(J[。]kkw=】項,£qiMPZ:頃WQ)H*(",n■=、■'*儼*ig,ge----_11

Jprintf,np.rQundtwQ,2))bo=d.^et_weights()[1]kkb=】項,阪旺莢頃bo)print(ll\nB=11,np.round(bo,2))y=npdot(x,kkw)+kkbz

=sigMoid(y)Print("\nZ=",np.round(zt2))|#...........coniinued.............................#...........coniinued......................defane_ruiiiid(x,t):globalmodeldxx=xrip臨船乂is,::dtt=tjnp,newaxis,二jiiode1hfit(dxx,d11,1,1,0,shuffle=aIse)deftiainir^():globalmoiel,

kkw,kkbX=DX/255forepir;r;in^&(2000):for1inrange(S)ione_round(x[i],t[i])遷移到卷積核___________)_____#...........Continued.............................ddx=np.array([1,0,0,0,0,1],dtype=np.float32)defgetY(dxf

kw,kb):y=np.sum(ilx*kw)+kbreturnydefcdhv(x,kw,kb,stride):

/xz=x.sizekz=kw.$izesteps=int((xz-kz)/stride)+1y=np.zeros((Steps),dtype=np.float32)foriinrange(steps):start=i*stridedx=x[start:start+l:z]y[i]=?etY(dx7kw,kb)returny#............continued.............................準備卷積運算函數(shù)continued...............................#...........Conv-1.............”)_____________________yl=Conv(tx,kkw,kkb,3)zlSIgmoldC^Ff/.....print(h\nprint(MZ1=",np.round(zlt

2))diefconvolution():TX=nP.array([255.0,0,0,0,255.0,255,。,0,0,255,255,0』,0?255f0],dtype=np.float32)tx=TX/255_k神2=np.array([1,1])z2=Conv(zl,kw2,0,1)...................print("\n-----conv-2--------print("Z2=",npround(z2,2))_________________________使用遷移來的卷積核Convolutioii()#End................................#_一二……training()#continuedConv-1IJT專家直接提供的卷積核丿yl=Conv(tx,kkw,kkb,3)zl=signu)id(yl)print(h\nprint(MZ1np.round(zlt

2))print("\nprint("Z2=",npround(z2,2))diefconvolution():TX=nP.array([255.0,0,0,0,255.0,255,。,0,0,255,255,0』,0?255f0],dtype=np.float32)tx=TX/255np.ar髯頁-ft,z2=Conv(zl1kw2,.0,1)Convolutioii()#Endtraining()-發(fā)現(xiàn)了2次跳機Z=[0.050.030.030,030.970.97]Z1=(0.970.03□.03(0,97)0.03]-----Conv-222=[0.990.050.990,99]t[88515rL7Io__yo-■41114-42242_=--woB]J1L-9-Z2[]都小于1.0,沒有〈連續(xù)跳機〉的現(xiàn)象Z=[0.050.030.050,030.970,97]Z2=[0.990.050.990,99]-----conv-1-----------*-Z1=[0.970.030.030,970.03]-d2owB]J1L-9t[88515rL7Io__yo-■41114-42242把專家直覺納入Al模型里|說明?專家直覺(ExpertIntuition)就是您可以看出來眼前的情況與過去發(fā)生情況的某些相似點(即相似特征)。?您的專門知識愈深,就愈能看出許多相似情況,而在菜鳥眼中,每個情況都是新且獨立的情況。?專家直覺帶給人們瞬間洞察力,也就是鑒往知來的能力。把專家直覺納入Al模型里|說明-例如,下圖是醫(yī)院里的護理師排班表:7ABCBCDBCEBCFBCGOFHOFIOFJBCKBCLBCMBCNBC0OFPBCQBCRBCsOFTOFuOFVOFwBCXBCYBCzBCAAOFABBCACBCADBCAEBC8BCBCOFBCBCBCBCOFBCBCBCOFBCBCBCBCOFOFOFJBBCBCOFOFBCBCBCBCOF9JBJBJBJBOFOFBCBCBCOFOFOFBCBCBCBCOFOFOFOFBCBCOFOFBCBCOFOFBC0R=OFOFOFBCBCOFBCBCOFJBJBJBJBOFOFOFOFBCBCBCBCBCBCBCOFBCBCBCOFOF11BE=BCOFBCBCOFBCBCBCBCOFBCBCBCOFOFOFJBBCBCBCBCOFOFBCBCOFBCBCBCOF2BCOFOFBCBCBCBCOFBCBCBCBCOFOFOFRABCBCBCBCOFOFOFBCBCOFOFBCBC3白底=BC=白班JBJBOFBCBCBCOFBCBCBCBCBCOFOFOFOFBCRABCBCOFOFOFBCBCOFOFOFBC14黃底夜BCBCBCBCBCOFOFOFBCBCBCBCOFOFOFOFBCBCJBBCOFOFBCBCBCOFOFBCBC5藍底攻人=大夜BCBCOFOFBCBCBCBCOFBCBCBCOFOFOFOFBCJBBCBCOFOFBCBCBCBCBCOFOF.6BCBCBCOFOFJBJBJBJBJBOFBCBCOFOFOFOFBCRABCOFOFOFBCBCBCOFBCBC70=100BCBCOFOFBCBCBCBCBCOFBCBCOFOFOFOFBCBCOFBCRAJBBCOFOFOFBCBCBC8E&I0IBCBCBCOFOFBCBCBCBCOFOFBCBCJBRABCOFOFOFOFBCBCBCOFOFBCBCBCBC.9|jB=110OFOFBCBCBCBCOFBCBCBCBCOFBCJBJBBCOFOFOFOFBCBCBCBCOFOFOFBCBC!0RA=111OFOFBCBCBCOFOFBCBCBCOFOFBCRARABCBCOFBCBCBCBCOFBCBCBCBCOFOF?其中:OF代表休假;BC代表白天班;JB代表小夜班;RA代表大夜班。把專家直覺納入Al模型里I說明-有經(jīng)驗的護理師,一眼就能看出這不是一張好的排班內(nèi)容,其憑借的就是專家直覺。-如果我們能夠探知這位資深護理師所觀察到的特征,并且將其表現(xiàn)于AI模型里,就能大大提升AI系統(tǒng)的質(zhì)量。-例如,護理師們有一個概念稱為:花式排班。AI人員就去探知〈花式排班〉的特征,表達于AI模型上。,把專家直覺納入Al模型里|設計分類器?藉由分類器來吸納專家的智慧。-一旦分類器訓練好了,就將分類器的W遷移過來,成卷積核(Kernel)。?有了卷積核就能進行卷積運算(Convo山tion)來自動提取特征了。?這樣就引入專家的經(jīng)驗、智慧(又稱為〈專家直覺>),納入到AI模型里。例如,專業(yè)術語〈花式排班〉就蘊含了專家智慧。把專家直覺納入Al模型里設計FX(FeatureExtractor)分類器BN0PQR102護理排班Al模型03代表:OF(休息)04代表:BC(日班)05代表:JB(小夜班)06代表:RA(大夜班)07080代表GckxI09101H1121131014151161017181920211代表Bad訓練1500回合LZAT丫環(huán)-1丫環(huán)一2丫環(huán)-3CDEFGIIIJKX[]100010001000010010000010100000010100100000101000000■1100001000100010000100100000100100100000■101000010001000100000001001000000022FX分類器神經(jīng)網(wǎng)絡結構,把專家直覺納入Al模型里|展幵訓練?于是專家直覺就成為FX分類器的內(nèi)涵了。-當您按下<訓練〉按鈕,F(xiàn)X分類器就幵始學習了。?學習之后,這位資深護理的專業(yè)直覺,就成為這分類器的智慧了。并以權重來表達這項智慧,如下圖:,把專家直覺納入Al模型里|展幵訓練護理排班AI模型0代表Ggl0.06學習完成!0.080.06-3.952.6850.0222.57969訓練1500回合代表:QF(休息)代表:BC(日班)代表:JB(小夜班)代表:RA(大夜班)-6.798457.25021-6.842732.7792-0.2960.030.020.020.03丫環(huán)-1丫環(huán)-2丫環(huán)-30.450.2720.4591代表Bad權2.7585-3..121.18-0.162.765-3.980.581.1-0.2960.0225.46-3.91-0.3-3.885.472.77921.2010.62-3.952.685-0.21.12-3.2、-017585-3.121.18-0.161765-3.980.581.1把專家直覺納入Al模型里123YYYrI-6.79845-7.25021_-6.84273u2'

2579692.77921.2010.62-3.952.685-0.21.12-3.2-0.2960.0225.46-391-0.3-3.885.47-0把專家直覺納入Al模型里17585-3.121.18-0.1617653980.581.10.450.2720.4592.57969123.丫丫丫2把專家直覺納入Al模型里1319-6.798452.77921.2010.62-3.952.685-0.21.12-3.20.45207.250^1/丫環(huán)-2-0.2960.0225.46-3.91-0.3-3.885.47-0027221-6.^3-丫環(huán)-32.7585-3.121.18-0.161765-3.980.581.10.459222.57969*把專家直覺納入Al模型里從分類器遷移出來,成為卷積核丫環(huán)-12.7792丫環(huán)-2-0.2960.0220.272丫環(huán)一32.7585-0.162.765-3.980.459丫環(huán)的卷積核1819-6.79845207.2502121-5.84273222.57969r-3.952.685-0.21.12-3.2.從FX分類器遷移出來,成為卷積核丫環(huán)-2的卷積核2.579692223-6.798457.25021-5.84273181920210.450.2720.459從FX分類器遷移出來,成為卷積核丫環(huán)-12.77921.2010.62-3.952.685-0.2231.1:丫環(huán)-3的卷積核0.450.2720.459-6.798457.25021-6.842732.579591819202122準備排班表(卷積的對象)匯入卷積核2.78Conv2.76庭4通道匯合匯入丫環(huán)智慧0.450.270.460ABCDEFGHIJKLMN0PQRSTUVWXYZAA1OFRARARAOF210000001000100010001000110034OFOFOFRARAOFOF510001000100000010001100010067亨JBOFOFOFJBJBOF00101000100010000010001010091011RARARAOFRARARA0001000100011000000100010003個丫環(huán)的卷積核把專家直覺納入Al模型里訓練完成,得到卷積核-為了簡單起見,上圖里只列出4筆排班的原始資料(4位護士的本本月份排班表)。?其中:OF代表休假;BC代表白天班;JB代表小夜班;RA代表大夜班。?請按下〈卷積〉,就展開對原始數(shù)據(jù)進行卷積運算,來提取特征(具有花式排班的表征)。0.27-6.840.950.810.9870.9970.810.810.810.990.4980.020.530.990.5270.9970.310.310.5170.00]0.4880.0250.990.960.9870.8020.960.3060.990.00]0.990.990.0250.0190.990.710.8020.9550.310.]]0.00]0.020.990.]80.9970.0250.9390.960.990.8020.020.990.]7匯入丫環(huán)智慧卷積的結果針對第1筆資料3個丫環(huán)的卷積結果2.咫].20.6-0.305.5r卷積4通道ConvH匯合0.990.950.50.020.530.32-45.5-0-4().6].]]]0.&。.&0.50000.5().300ABCDEFGH1JKLMN0PQj]]000]000]000]100012AAABACADAEA]]1213141a1516上17182237卷積的結果F0A00450.270.46B0C0E0卷積ConvD]J0通道匯合H]]_0L]針對第2筆資料3個丫環(huán)的卷積結果G0W0V0]00匯入丫環(huán)智慧Z000]00.030.S000.8000.800.03。盅00.03。盅00.03。盅00.03。盅0.310.020.9610.421-6.87.25-6.842.5S0.50.5]3.2].]0.520.490.99MN0P10002.咫].20.6-4-0.305.5392.763]1.2-0.2190.5200000.3]0.950.810.80.9幻0.9970.950.&0.S0..]0.&。.&。屈0.990.950.810.&]0.81。屈0.99]200.490.030.030.030.0300.420.020.0300.4980.420.02000.50000.03().50.020.030.030.030.03().502]{).00.R0.R0.R0.8]]0.32000.5270.9970.32000.5().30000.530.320000().530.31]]0.5200.3:]]0.52000.30.5170.00]004‘0.3]]]0.420.420.490.030.020.40.490.030.0300.4880.0250.030000.40.40.4*]]0.990.R0.96]0.990.&0E]0.9幻0.8020E0.&o.s]]]]r>、館290.9S]]0.990.9]0.5200.080.]0.00]0.3061]]]0.90.90.9]]0.990.90.90.90.9&0.990.90.90.930]0.420.42]]]0.490.030.86]0.0250.0190.420.40.4]]]]]0.4]]]1]]]]]310.99]]0.980.9]0.990.&0.710.90.8020.9551]]]0.90.90.9]]0.980.90.90.90.990.980.90.90.9323334000.3]0.52000.31]]]0.:]]0.00]0.020.9]]0.90.90.9]]0.990.90.980.5200.02o.is00.3350.030.030.020.490.0300.020.420.42]0.9970.0250]]]]]]]0.4]]]0.490.0300.570.030360.80.R0.960.990.8o.s0.96]]]0.9390.8020.020.]]]0.90.90.9]]0.980.90.990.990.80.020.170.8]38AAABACADAEA0.322]27323334353637卷積的結果針對第3筆資料3個丫環(huán)的卷積結果0450.270.46]00Z000]W000.50.51).3.]]、0.40.4]]]*3)00.03。盅00.03。盅0.810.030.8000.80.8ABCDEFGH1JKLMX0PQ000]000]000]10000121314匯入卷積通道2.咫].20.6-42.715丫環(huán)智慧Conv匯合-0.305.539-0162.763]1.2-0.22.81718zHi19().5200000.3]0.950.810.80.9幻0.9970.950.&0.S0.80.1200.490.030.030.030.0300.420.020.0300.4980.420.0200°1210.990.R0.R0.R0.8]]0.32000.5270.9970.32000J-6.87.25-6.842.580.990.950.810.&]0.R1。屈0.990.50.020.030.030.030.030.50.530.320000().530.3]10.5200000.020.420.490.030.030.0300.9610.990.&0.R0.8。盅2324]]0.5200.3:]]0.52000.30.5170.00]0000.3250.420.420.490.030.020.40.490.030.0300.4880.0250.0300026]]0.990.R0.96]0.990.&0E]0.9幻0.8020E0.&O.S]*0.98]]0.990.9]0.5200.080.]0.00]0.3061]]]0.90.90.9]]0.990.90.90.90.9&0.990.90.90.9]0.420.42]]]0.490.030.86]0.0250.0190.420.40.4]]]]]0.4]]]1]]]]]0.99]]0.980.9]0.990.&0.710.90.8020.9551]]]0.90.90.9]]0.980.90.90.90.990.980.90.90.9000.3]0.52000.31]]]0.:]]0.00]0.020.9]]0.90.90.9]]0.990.90.980.5200.02o.is00.30.030.030.020.490.0300.020.420.42]0.9970.0250]]]]]]]0.4]]]0.490.0300.570.0300.80.R0.960.990.8O.S0.96]]]0.9390.8020.020.]]]0.90.90.9]]0.980.90.990.990.80.020.170.8]38wAAABACADAEA-6.80.452.580.8000022]0.500.40.50]]0.8270.9().9]]]0.4Z90.90.9]]卷積的結果針對第4筆資料3個丫環(huán)的卷積結果7.25-6.840.270.46]00]]Z000]X00]ABCDEFGH1JKLMX0PQ000]000]000]10000121314匯入卷積通道2.咫].20.6-42.715丫環(huán)智慧Conv匯合-0.305.539-0162.763]1.2-0.22.8171819().5200000.3]0.950.810.80.9幻0.9970.950.&0.S0.8200.490.030.030.030.0300.420.020.0300.4980.420.02000210.990.R0.R0.R0.8]]0.32000.5270.9970.32000。屈0.990.950.810.&]0.81。屈0.99]0.03().50.020.030.030.030.03().5000.530.320000().530.3000.3]10.5200000.030.030.020.420.490.030.030.0300.R0.R0.9610.990.&0.R0.8。盅0.990.90.90.90.980.990.90.90.9]]]1]]]]]旃0.90.90.90.990.9&0.90.90.92324]]0.5200.3:]]0.52000.30.5170.00]0000.3i250.420.420.490.030.020.40.490.030.0300.4880.0250.0300o126]]0.990.R0.96]0.990.&0E]0.9幻0.8020E0.&O.S]J28290.98]]0.990.9]0.5200.080.]0.00]0.3061]]30]0.420.42]]]0.490.030.86]0.0250.0190.420.40.4],310.99]]0.980.9]0.990.&0.710.90.8020.9551]]]]32與,V鈿000.3]0.52000.31]]]0.:]]0.00]0.020.9]0.030.030.020.490.0300.020.420.42]0.9970.0250]]]0.80.R0.960.990.8o.s0.96]]]0.9390.8020.020.]]]0.90.90.9]]0.990.90.980.5200.02o.is00.3]]]]0.4]]]0.490.0300.570.0300.90.90.9]]0.980.90.990.990.80.020.170.8]38交由大丫環(huán)匯合特征表-得到大丫環(huán)的特征表丿這筆有兩處花式排班202]2200000023242526270000003800000000000000000000000000000000000000000002829303132000000000000000000000000000033343536370000000000000000000000000交由大丫環(huán)匯合特征表-得到大丫環(huán)的特征表這筆有許多花式排班丿I于是,得到大丫環(huán)的特征表-您可以看到了,青色底的部分特征值為1,表示發(fā)現(xiàn)到有〈花式排班〉的表征。I進行池化(Pooling)-然后,進行CNN的池化(Pooling)運算,萃取一周內(nèi)是否出現(xiàn)〈花式排班〉現(xiàn)象。把池化的特征表,交給格格-最后,建立全連接層(FCL)分類器,并進行訓練。把專家直覺納入Al模型里|訓練完成-這樣就完成了〈排班>CNN深度學習的模型的設計與訓練了。-目前已經(jīng)完成〈排班〉模型的訓練階段了。I進行測試-現(xiàn)在就拿兩位新護士的排班表,來給AI評估看看。看看是否有不良的花式排班現(xiàn)象。把專家直覺納入Al模型里|測試結果-預測的結果呈現(xiàn)于粉紅色底的部分:?第1位新護士的排班是正常的。-第2位新護士的排班則并不理想。把專家直覺納入Al模型里更上一層樓-以上的范例,只是展示〈特征提取器>的基礎能力:支持基本的分類任務。例如,辨別<好>與〈不好〉的排班表。-基于這項基礎,未來可以進一步組合AE模型,來進行理想的排班補值(生成),由AI來幫助您做〈智慧排班〉的工作。?祝福您輕松愉快更上一層樓。范例實踐I延續(xù)上一小節(jié)的護理排班范例10RARARAOFRARARAOF110001000100011000000100010001101218范例實踐步驟1:建立FX(FeatureExtractor)模型-目標一FX模型,能吸納專家的智慧:即分辨〈花式排班〉。-方法--設計一個分類器,讓專家貼上標簽,進行訓練,學習專家直覺。范例實踐|步驟2:遷移出3個卷積核(Kernel)-目標一建立特征提取器,例如卷積核(Kernel)。-方法一從(步驟1)已經(jīng)訓練好的分類器里,遷移出Wh成為3個卷積核。范例實踐|步驟3:幵始進行卷積-目標一針對排班表進行特征提取(即卷積),如同專家審視排班表。-方法--讓3個卷積核(昵稱:丫環(huán)),對排班表進行卷積。范例實踐|步驟4:將3個特征表(Featuremap)匯合-目標一針對排班表的每一筆,得出一個特征表。-方法一使用分類器的Wo來3個(丫環(huán))特征表,計算(匯合)出單一特征表。范例實踐|步驟5:設計高層分類器(昵稱:格格),并進行訓練。-目標一設計&訓練格格(分類器)。-方法一拿(步驟4)特征表,作為格格分類模型的輸入(訓練)資料,并展幵訓練。范例實踐|步驟6:匯出FX和FCL兩個模型-目標一提供兩個*.pb檔案給OpenVINO。-方法一將訓練好的FX和FCL模型導出到*.pb檔案。范例實踐|撰寫Python程序?撰寫一支Python程序。-訓練好的FX和FCL模型導出到*.pb檔案。],dtype=np,floatB2)CIDI苴BFa/rly([[LO.0,0,1,0,0,13][1,0,0,0,OJ.O^CJ[l,0f0jc,0,03,0][1,0,0』,0,0,0,1][0,1,0.11,1,0.0,01[0,0,L0,l,0,0,0][0J.0J,1,0,0,01[0Jf0,0,03,0,0][DJ.OJO,0,0,1,01[04,0,0,CI,O』,1][0JJf0,0,1,0,01[0,0,0J,0,1,0,0][OfOJFOf0,0,1,03[OfOJ,O70,0,03][D,OfO,l,0,03,0][0,0,0,1,0,0,0,1]dtt=np.array([O,O,OfO,0,0,0,0,lfl,O],dtype=np,float32)#---------tinued---————-——-二^--------------------------defsigmoid(x):return1/(14-np.6xp(-x))準備FX(特征提?。┠P偷挠柧殧?shù)據(jù)#ex_Al1_06.pyimportnumpy豎npfromkerasmodelsimportSequentialfromkeras.layersimpo11ActIvationfDensefromkeras.optimizersimportSGDkerashack巳ndKimporttensorfIowastf訓練1500回合N(LP護理排班Al梧代表:OF<代表:BC代表:IB(代表:RA0代表Good1代表Bad1000010010000010100000010100100000101000000I10000100卻1000100v00100100000■100100100000101000010001000100001000I00100001000■1AT0000FileEditFormatRunOptionsV/indowHelp撰寫Python程序whi=[np.lrriy(continued[[0[-0.[0,[0,ro.[o,[-0.[-0,np.aU.1],0.0,0J]0,1]0J]0.1]0J]0.1]0J]dtype^np,float32),0.0],dtype=np.f1oat32權重初期woi=[np.array([[-0.1],[0,5],>0,1]],dtype=np,float32),np.array([0,0],dtype=np.float32)]丿kernel=Nonebias=Nonewo=Nonebo=Nonefeature_map=Nonepo_fm=Nonemodel_l=NonAmodel2=NonpContinued準備FX的丿o?5■555555

溫馨提示

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

評論

0/150

提交評論