From 90149463cd38822ab160415939a8db4a14e2a9e9 Mon Sep 17 00:00:00 2001 From: Dhvani Patel Date: Thu, 27 Jul 2017 13:53:45 -0600 Subject: [PATCH] Update formatting for testing model --- __pycache__/toCheck.pypy-41.pyc | Bin 2337 -> 2604 bytes predict_file.py | 99 ++++++++++++++++++++++++++------ py_mutations_hub.pyc | Bin 10233 -> 10628 bytes test_file.py | 2 +- 4 files changed, 81 insertions(+), 20 deletions(-) diff --git a/__pycache__/toCheck.pypy-41.pyc b/__pycache__/toCheck.pypy-41.pyc index 0c426ee9297581ca5bd9cd370b7f8ff18c0d319a..462cb2f93cfeef90406e38e7c6a5f31b6924e241 100644 GIT binary patch literal 2604 zcmcIm+in|G6x}nv#CDPW_#xci;R9f;Jx-iNh)PJ8|_2|~?7k!z2YSXv<1xk#c zC#gtJQPk+d$uIqA*G zupzw$daGhYj+!#?B(BM?B5y=q^jfsL+o{8c9S^FbbK`Lmf8O!gtUyGgkz*r1 zaM$sAW}?C!n8@uJ>oy~6&I98HoM^v*fXyBZ3Jt8L@Q zkCBYHF7cck!mEZn=9DI<#7&7?WgA%%WN97_bln`}-uCX^PWP!>g#OL`-m@^+{(gTa z*xpJSbdu@Ji{voLG|a+=|?Wfv-KmJXLbRdn|bC; z=GNTt$f#*uvsa8wpf#eAex41ILoL_0QEH8&iw+eD`)Pv3YR~# zpRzVOELV%KHt9Y~r8a*@#!%QJH46{|egN~NqMbkudP=IN*T@iHUVh;xkIVK7%hFN1hT=>M|!(mVH701)q8%d)S}5XlP0k&6N%E15u8J(t{I z?aP2?kit0NDm|H!*b@G;9oCaS(C(07C1tqdD7Q|TM4~B#Cibv zxx%_Ic7%h#ls35jJTYMsUnPQainKqU^buCrHiT5xyqn%Cz7PD?RKHuft$lneS;!mO zSF(Hx=JjT^x!SCi*JuL+<1BIXO|95uI7$uA15J$*erGt!aR3wr zBr(Q+Ljm5RE20#qL-Y{$c9~YawYcxuzajPDpIp-zH_E7*pO9eF~%h#&-ZD{t1Wyf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y?%qau^J%MI-l=eMzlQN(R4&1Ppb 0 a = np.array(toPass).astype(int) - assert len(a) == 10 - print a - yield a + b = a[newaxis, :] + #print b + check_tokens.append(toPass) + assert len(b[0]) == 10 + #print a + yield b windowInd += 1 + #print "WINDOW" + #print windowInd print "done radha" #print len(one_hot_file) @@ -232,8 +245,17 @@ def predict(fileName): opt = optimizers.RMSprop(lr=0.001, rho=0.9, epsilon=1e-08, decay=0.5) loaded_model.compile(loss='categorical_crossentropy', optimizer=opt, metrics=['accuracy']) - outPredict = loaded_model.predict_generator(getFileTokens(fileName), 225, 3, verbose=1) + ''' + gen = getFileTokens(fileName) + arrs = [] + for x in gen: + arrs.append(x) + print len(arrs) + print type(radha) + ''' + outPredict = loaded_model.predict_generator(getFileTokens(fileName), 227, 1, verbose=1) + print "HERE" print outPredict print len(outPredict) @@ -246,26 +268,65 @@ def predict(fileName): countGood = -1 countIns = -1 countDel = -1 + countWhat = -1 + iterInd = 0 + print inds + print zip(*(iter(inds),) * 10) + + + global check_tokens + check = check_tokens[:] + print len(check) + #print check[225] iterInd = 0 + with open('vocabulary.json') as data_file: + data = json.load(data_file) + print "-------------------------------" + for window in check: + errType = inds[iterInd] + if errType == 0: + msg = "NO ERROR: " + elif errType == 2: + msg = "DELETION: " + elif errType == 3: + msg = "INSERTION: " + else: + msg = "IDEK: " + errLine = "" + for toks in window: + getInd = toks.index(1.0) + actualToken = data["indexes"][getInd] + errLine = errLine + ' ' + actualToken + print msg + errLine + #print c + #print type(radha) + iterInd += 1 + print "-------------------------------" + sys.exit() + #print type(radha) for b in inds: - if iterInd == 3: - iterInd = 0 + #if iterInd == 3: + # iterInd = 0 - if iterInd == 0: - if b == 0: - countGood += 1 - if iterInd == 1: - if b == 3: - countIns += 1 - if iterInd == 2: - if b == 2: - countDel += 1 + #if iterInd == 0: + if b == 0: + countGood += 1 + if b == 1: + countWhat += 1 + #if iterInd == 1: + if b == 3: + countIns += 1 + #if iterInd == 2: + if b == 2: + countDel += 1 + #print b iterInd += 1 #print b print len(inds) print countGood print countIns print countDel + print countWhat if __name__ == '__main__': fileName = sys.argv[1] diff --git a/py_mutations_hub.pyc b/py_mutations_hub.pyc index 317011ad63863bef5d96bc80a0b46ef5c37562da..abeee6aaeb2ca8ea417b775ebdfd78466945578e 100644 GIT binary patch delta 1062 zcmZuvIcyU_6n%euBykLw;3UpLF2@J=k#NKuf+XT-La>X#O0byB5ZQ6!#NI%-lp+XG zAR)9=6cp45B(_782#JCSXppEV=qNyf2GQ_mk{}9pHE-Vh{qx_O`TOhCtz4V$$C^+u za_#ImRvsVEM|e~p-EaG{07yb91}g>`g4F_9533b2466+jfYokrqrncSPFP)#YhZOl zu7%ZOFm58fkn3P2AS1AnCZ2*^4=WAX0BaNE2HfI;n<1lyY=LZCFl;MilOfw6n+@3x z88c)DWQ!p?AzKaE1=(iEZm2%Uc1#LX9t!QXAM;0{_CRjLB4PMkAFRDldvW{(g9Ijh zsC*-}OUF3D+J^Mek$n(*VtSx7Q8|dhET4yrJMH-Snip6lwLIH@u>B zn0OuLpbw4IL`e~+gc#=_GCb;d4DqO5bst4f)13P~+DX!jG=8n^o~Xmk0o)isj(d9i z#0@aWI^?t`u&1co)bZO(b?zj}cxSr$eDzL{OF8Aye6{M%`iI=5csLl-`qKLxKTiu= zy2JipfC9q&rrLvlRli;D1d0Sl=p##^yTI+bxuT|j=#grKF<&a#GZkgayp!MV%sadR zs9a3z45x-+e6%n=SyI^+=GkV3w3c#eLX5n5nD=RW#~gk7iNa-d(os{@*IcHmOM#qP zM%$js7p85y@Sbb_Us#vD;*KTablAO~`00PgYj-;N;KCA<><5OGO4Io%W!uiGd+pqI z%JvLjRJLB{Ht1Y)fbwWo--YpQ3|=afRL&_^l%p?8&P~l^@41Q8CA#e1P4&1>QvLB~ bb^b5~X#)i)%x{#|QG`NNBSIz?5C`cG!;jd^ delta 711 zcmYk3%WG3X6vn@EuQxW2rZ!DXle9_N#59SInum{yf>fc!MM@i`WWZjcb6e7qM3V>= zgf7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