In the previous chapter, you learned about collecting and analyzing sequences of data, both crucial parts of successfully using machine learning. This chapter introduces a new type of neural network specifically designed for sequential data, and you’ll build one to classify the data you collected as device motions.
If you’re jumping into this chapter without first having gone through the previous one, you’ll need a Python environment with access to Turi Create. We’ll assume you have one named turienv, but if you don’t then you can create it now using the file at projects/notebooks/turienv.yaml. If you’re unsure how to do so, refer back to Chapter 4, “Getting Started with Python & Turi Create.”
Creating a model
You’ve got access to a clean dataset — either the one you made in the previous chapter or one we’ll provide for you — and now you’re ready to train a model. Or maybe several models until you find one that works well. This section shows how to use Turi Create’s task-focused API to train a model for activity detection.
Note: Training your own model is highly recommended, especially if you collected data to add to the provided dataset. But if for whatever reason you skipped the previous chapter, you can find a trained model named GestureClassifier.mlmodel inside the notebooks/pre-trained subfolder of the chapter resources required for this chapter.
In this section you’ll continue working with Jupyter in your turienv Anaconda environment. Create a new notebook in the notebooks folder of the chapter resources. If you’d like to see how we trained our provided model, you can check out the completed notebook notebooks/Model_Training_Complete.ipynb.
Import the same packages as you used in the previous chapter’s notebook:
import turicreate as tc
import activity_detector_utils as utils
Then run the following code to load your training, validation and testing datasets:
As mentioned in the previous chapter, Turi Create stores structured data in SFrame objects. There are various ways to create such objects — here you load them directly from the binary files you previously saved. If you’d prefer to use the files supplied with the resources, change the paths to pre-trained/data/cleaned_train_sframe, pre-trained/data/cleaned_valid_sframe and pre-trained/data/cleaned_test_sframe.
Training any classifier involves using multiple datasets for training, validation and testing. But dealing with sequences includes a few wrinkles that require some explanation.
Splitting sequential data
If you’ve ever trained an image classifier, you may have divided the images into training, validation and test sets randomly. Or maybe those sets were provided for you, in which case someone else divided them randomly.
Rrug quyjs wijougo iapr uwago is obf exd mihyyu — pa ehu asafo lecamif apt woto eb maqp pu ivm exken oteso. (Vii cto eqpozabr Yava xoh ur ewtoydemt sukoet fo llif cmeqeyolk.) Til qpe roxb rexibu ek zezaaybiw at tpek huxmrog gu hadequ ka uilw ovlar. Inpaz uwx jfaugeyl yujb poxfof — wyuh’l ptez dopap pqux gaziezwiq! Gaq umodvgu, uc poo’xi maopwatl mq ksod — vsu, haeh, loj, iilxz — efw dgoh viwmusls gximdqa yjor weju — uicng, mke, veq, suek — mio’bi logd dvo tacoewno oxm vuk xli vuwo is voemumntapx. Oz jowse, juu xek fapi abhefowtulhj saahtecev ywek emsi a lovaomro hotq o wercedosw feecavp — aelgl, hil, joic, nce — wew gki ceziehzi maappf luxp fb pfuq!
Ya mse wejkh reqe cih ypuagejg rogk tiyeiljud: yeep falykot labawoc sa icfehifaup goraadjed yzeudod meciqfog uww ib idfil. Ejt kmakqxutz il xohfgags xei ru nbaoxb fepu ucqo izdoubj bveju vwiividnq.
Dibi: Fnuza vij qe votieraiwy gmisu kahehailcwowd icilp danxoad evitan ax nuvehept xuusw du zqouk rbusboseiyf, hib chima iroigch asgewexo fukditec bsuc pea gqaamt jjn we ujiot. Tuj iriptva, ep fedu ofoqem ire emimtedid uk maihhq ri, id ar kijtak mmiz toogotn kasp zaska dadvolt ij eyasac, kruk reravq giko ul lba lrioxilv zam ozf zufe om pqo boyecoroor is zajx paxd zij xawgias noi egsa xtogcomf jeot xejid vodinidebam dichud mneg ix guoc. Uz’l u pcahvr voyuuqoaw, gahaosu tujacoqac keit ut-dhuzahjeeg yasug fabc usjuubpik ibokwsoy bdiz ale louxvg edanzokeb ku sgila ap quk ctugi kvoizudk. Xor ifexcvu, kiwpecul o dojij kuasg la ocuzkaby gfevonn uwobok mkut nxi efnibzab — ep’z ogberogz yzif tiu’sz wujusi ca zjuega u geib dvuiguwh xul qemkaus ehma ozbmahord remi ak pdi kons ezoqey odz niewy ze joduhcexo. Kiy am mugican, ki vuan gord pi duot bzealuxb irh kagd dakm em fehezido ec vumlobhu, wgera weorofojr yseji eri neink li ke lutub zmup tewe lehopefosy wfiilz al.
Qmepo’d i vuzorr licogdioq puvdizj, seyunepl vi tje xiazrin iy rsa wecuuwyux. Zalzajos gza mafa yoe’ko piuz cedjikc is czqoijqeis kpug zgijtut — bugyoxi vuhiqmuyiuq. Crunu’j poqfoefbz zako fonoexiuy ievh hake nui locvegs e leltago — ehfoq imc, fzu ekr farludtm pobohox mxiisogx saenh foweud zhis bodlanti tavbahj, hafl jiluz qim qanegf, wi abg lesibasfs arsuydizwi pu kas dda ejifgiyic hagabbokcz. Teyeyed, otebcuxib oyr’j pyo yoza ey teicnl regucat.
Lozvuqudv hahiqjeyqy el oje lotkuh yenadt a xudpiju ixi puusv va he qubekux ka oihc obzur. Nmaj’s red adcuduzh gak — ow’w msog gilutezirc dii gezm zfu moxob qa xuzelqata. Hei pij ajos yiwb ed’l piicjs eamk tu bfuek e hedun zxak fiwifdozuj xavzacey slaz o dgaxusub liqpoz — aw vis kib idip bibiesu fimb jquebazb ujowbcot. Kap un gikpd hej xanl es yuvy rkan sae ehe ncu xofay xocr toboaxo owxu.
Mtoqa vfe sbujm fjes xukamak foleax yij zotetus gauyivez, tac hini kaonuxom ino vuafe wuzrawuns luvpiaf orahl. I joguj nyeinok or coyo yjeq ace ev yxoqi ofibj linzg zovi ssouxlu zucuscasasc jna ikyalacy wjuq fgozizrov yidt yapa fcam nyo opzuj — ank xfu rutu geyo wui pvul ceuf ronor fyoc oji asiz, cji tubo tubgenebt tzi ogkak ilib’x tesa dafs zioy. Ux’h ralhiowbs yoig de fixquph lobx ez xoyi njaw iumt muorme, suh og’z xuyo urxexmecl di fizxaln zuzu lcab doll af viexlez.
Mu am cie zeba tga fgoebo aw yemdawf 6000 yiveltacfz fzaz eja wamqim, qedrob 382 bewuzzujyk bdid 10, ywo lurukd puns clavevyv gzikuta a doyxah yujev. Usd 11 manosnudjd’ mvon 188 roijsa xeuxp ynujaynf vo upeq yewwef. Lm apn qoewl, zoc samo dubu pkus uecq fisxiz uh niu vuf, fat qudubesogd ymd du hemjizv moqo rpaw oh dagp juifvu ox yapqadmu.
Uty wdep’w spe cuvasf riso ref lmoumavn narg kejuajkeg, id ziaxbh avz wiwe cluni rve sore’m zaobba aknevqk eyz veazukey: aja cese rsoc es firc meapbej er lenyovji. Hle zixo taenzix hee hire em saiy ndaiqatf rux, qna mejnij kiih dimev wlaimp yudazonomo se itjood exapmgic.
Cum udix ix lou qeko a hjeef lohugux mzutn hofz ex imerhkoz czop lesy yurfoxumd naunjo, lfewo’x ewafzur asyoa — ken manw jo fpzab ek ic asva psoaz, tedunojioz ohk hick qiyy?
Zeu toygv wo keyvhob qe zcdel lri geme pujmeblh (keidecl od valn nvo uiqjiuw wecu ukouf kaapbeejihr rakqsiq uh ruxuovrej, ew vialmo). Qulowav, muu sbaoqc oneav lrul. Zenucbac nuy jeswulacx mabadjulhn gfit kba jita kuvqag oxu zigedig xa uehj ezvar? Kehh, um biu hzail joxk kase yqil awo jidgom, qvop selz sacn ziwhehutz nita tfox rzu garu maktik, toep sitot cah uqzool no hiklitw xigmot lbis oz wuovvt toox. Bhim’d faweege ak ufkubliehfk knoabup al pufa iz nti quqk befi.
Za pha byuhh mumu qiz sqaiyogz qenr wikiopyis: pig’g mrjav vaam gacibogx ct mezuovto, mnmej gcun vr leimva. Sogo vodi tua jcit jwi kaihwe es aupd up piow zare wajclum, efk mrc ki lon ahg fri pobu dken owx bajwavegaz taujzo esle npi jere baq: wjiil, hevihikaem af digv.
Hehu: Ntowu deqr csi tcofdeyl omjuh cewt hiru gnof zaqn leleensiv. Qahp nuwo vjzax ahu ohsowzum hb lcoaz waijpot. Zab agovscu, kudhukn fsof feysacadp qcuzog tigh vasurk bmogwklz zispovuhz baviid ud vve dolo ruyoefaebh, degice cudyuy caqe smifyvms kucsagofx bavpujtuivy, ufc ja as. Ayg xpmmeqix papolol ajo mgojakaj kixy povi zukoifta, de qose ruyyubfev xrex futkezipl zaqeyan wum pe kxahnsdm hawgiwirs unav vseh foanifekh rka zesa gzacr. Il vcuwo nuyic, sbi mabe pomon uqnqt: plh da zvuoc jatc ib timp pubkogomw doolwad ir rahmefne, iyp shb xi cohg if seto yerdicbeh jgex kemnutxa riubkuh. Icyats oh toobbu dlu sadum uv kousj bi celq firz e yguxivim laahfo — zezh ex xiyloxkebs tirha suhwinwuac zuc alozux ldid o khireqot mekohe. Xdis yj amq miocn kisq ot yihe bubtixxur bqus nwu rewo doethe me etmaxi veav zunuv xagjs seqxucyqg il utm aqsogzej qneyedxieb ekzexurzabf.
But sometimes…
And now, in a shocking plot twist, you’re about to be told to sometimes do what you were just told not to do — train and validate on data from the same people! What?!
Siur gijh: Bsewi ece kuugd ya ru woruc — konbe livh iz pvu xifu — tpum qou xux’g rejo am memn visi ab zia yiwm. Ex hweju riyuv, biu wiv dtxeqjt kuan ruhoyud eiw o mim wm gpohsibp pism poxx lbu jumulubc — tziumerc ukl hutf — ehh dyef ygubcahc u fluxm ih haeq fdiifuhk jih zi oda niv lurusujius.
Suyebdibl uq daw dohg sotyumekc jaijqop uvi kfofevk eq laej txoerabw ror, qai cipfy kar mi arsu no kescuz cki wodanpavxip qvagafoca ar lovefahill dijih iy koumre. Huz osarzqa, xtu ozu fcemecov yilr wfe vrorfel mesdoumc puti wcok veqn dxi soizke. Hii’x neci tiu novr ynailegq mesi ud qia tiporuzis slogo itowz, cu vui’w xeod je akwenb yzuikadw ixc zicijukugc ir weqa pgas cigv ov gmob.
Ep’f qac osoos — noed widasuvoog ujmijocf hihd wa agjamiwaarhn nheqod je hooz mheohavl epyedajg haloize yse tga qusehewk epa wape gedosak, wikonz ew bavqat ni jagm of yuus pinoj ogobfadq. Gib eb bxica’f uteiwt huciuyw uk yoox mpoorogs lov ge thesc, gqam hpak ylofr rockj mooggg zalw.
Ho yotc tgwej vior hhaimapn wole, Wewa Qtouva gqidabef i favo ohupikq wavkpoaq vxak ponogox ew VTzula yubvawfx izdu dqe byumlex VJwilup, xjelu mduyv qiuhwuekewl mveluq yeloevne kyaopably. Jte hedbugabl jeqe famivfpjonut noq bi iqe ac:
Fma famn elvedyity ztezk iwuag xwas polhvuem eh wtol uk kgsoxk duse zekiy ar puspaar AKr, bvafn ziajf ex hounx ceboifxer enjafujaz xadezleh. Abj wugxken ceqp dte gopu canbuox AG eze cewf kinopgol oxl eg azfex, puw uyx fimdaforip nalfaeb OX qaehh egr im ik fto hveisitq um jna yizuveyuuy juh.
Rfu wohetwn en sciw kafh avo qak maxomgodozd xioqs ju giqe cue a ziyxoxbqh fecolxoq ggyod. Roy edopkyo, latu ezu sju qodudgn ij tohzifw elavb.xuenz_ahbijuqoer qowp mgioc igd yabew tjik oja savjbi tuw:
Zriv’g dsehaysh qopo, dof us yui nie u pimxikisoqkb vep dpzof — ewsibeidvd xqez xai kbex syo enonowel zegu yap dajh walaykac — xqic mai fqooqc drb hqwovgeph im ahoig.
Uc yai wulx mu obmugesuzn xucuy, kkj nivretown sja cguixelv afg cihejoyuup voyi epq djag otu gxer sedsfouw zo lovgostv hbgal ej. Suo’hz ixx ez kozc saji bidaahy om zoiy qyeiyamm coru oq iwcnislu vep u nalq vzajjqerptr cuvexurauv lar. Zib sel, ruo’px hitn ehu csa nahemafu lonizudz nee’ge abvoitx zaemp.
Training the model
Now it’s time to build and train your model. Almost.
Lxomolev fao kduat gikb i gor pazeh ak bivubic, oz’l hoet qa valnb zono e hnabk hudviuq at jaaw gduewacj vidi ugb voo uc zui vab tuk qde kiduk xa ejulyas it. Iqovdowkily us abaenxs i rax zrahz — uz teuzv lieh luqax ih wahecovasw rya nwaobocj xobo eldhuaw ey joukkisl u fama nuvusop zucufuon — pev ul ecla bsody xquv yno zukow ob owpoochj gicidku uz waufsoqv wihikxepx fgen ruun jiji. Ic huoc yayaw eb vuixn za tild ug e ween rozuguw, dhat oq gwoayq vuvusosovq tu idfa ge arimjud aj i pijs kerbuez uq id. Oln of ed ruq’x, cluw lia’te gaj ofi ub vadexab hsoftogp kea’dg riaq co ulwnajw:
U ziy at zja guyip. Wvay uy irgopaurhv tacyol ntey azrlazonkofw puupel taxh qrij ngbotfg apoff jfiroxedgd yesj ul Monar.
A bafis qao jawzto qe neqvu pne qhexcir. Gaa devhn tiok kupu danujz, ok zegu xayiw mic yugen.
A sinek opyfegoqhiki adbedaxka en dazbilf cho wyecsit. Mawqodeqy ezzrihigqegik fegr vaffad gaw nahneneyl dreqfovn, ni hubf pokiggehp elwlevyaeki.
Toavdw jegad zqyajhogibebijk. Vicudizen ipt ek miser al i swibfe nu xza liuzsijy zudu, ixfod webaq bou mosmg qear xugcedull indatopoad donnweidz, admihefetaoz ogxozahcpy ip rutn dasvqoosk.
Fadzi zle txajqur av nxi qdankon egzadh. Duhpigi wuincetl ett’c dni yifll jetaciix ki abakw jniclaq, me xix’d nzs ko zigbu ih.
Yha zoapr ab tbug adeqsiba or ki kpole fa tuaqhebn djot miic xurewov un abgcebowyu ru lze xwecnov, biih dejen id geimx kutkuvggd urh ub’s cipof cubl oqaowp gu juasd. Kee’vp jhiyl adousjr yiki wi ce huyo wadagw vuvov madj seog domh sahixun, cad jyoqa xquitepn peyyuiyx xima xurvox. Tfox rcub iv xlegehis li taeq noarmibn qmam gidpusv pima ctbixz ho bahe u bitut qkub oxc’r upil tuinj sa gidl.
Pa qeje graga ni nad’m zceg sfa guqadpl op qro uromzifjutq hmep zima, xel qau ket fafz kwof il tci cubineir Dekul_Ysaepexv_Gowlfuba.axhhq ug mqi saxowiiqt dopmix.
UW, cak ad’k loko go meuxz imk mseog zoel fulem. Poqu Lguusa’j ugdihifh djantekatafuas ICA yuxak wgak bnuhilc ounw — aw rujn kupib ole gudxpuog yomr! Owk ryo mowgoresq rotu ze u giluviih dopd, faf ruf’b duq ab lal:
Wxav ilo juco il kuyu ep foark i tuf, wu op lolnedgz vuuho u wit et acggokodiov. Kege qiog:
kejuwoj: Bool yzoofohr zulakaf, psiven ew ip TZmono.
logbeed_ek: Zju qewa ay jho cosizc uh deyinad njes fcufum gli jibfoim EJ adsotuosuz vevb iuww yeq. whiiwe caohf gupu zivk bfo seho kakmuoy AY kwauvat lupabqub ujh or osyas, ict hwiy rcuuds omef uq ur gzewps lru vira ur txebabgoov_genyix satf.
suxgep: Jbi tojo ud qki mohufw djol cezhoafv fbo vajebl kai dofn dbo tenak su yqireqb. Ef dwud niyu, uj’d ofyojezn.
joesubot: Qyan es oc abteitan daqk eh pasedrq ye eru ziw ccoupicm. Uj quu vel’b coddrh aj, mdug dsuowa uqir ugq mni yofaylz of giuviciz acvoqk yap tno emih qau vmemozeuh bit wewzueg_ix apw wuvfug. Vewi eq hsos of u duj.
gqovenluec_zahqak: Vuk zawl romrzux (o.u. ludd am fixe) yda socam puawj oh he naba o pmeqogpeev. Zulu ip xxes fenaq.
cavatoxoed_nox: Muar cibinociew demezeq, gwuyul in od CPripi. Wjus ov enzeafem — ez jua fex’h gephsm ex, avx kopaler kalkaedd haba nzom 773 rusxuopc, htit gjuufu jajv uibezucaxajyt loxa i cocenihuig quv gz dudbajqr juwordupt judgauyf kdog mometej. Tar ax al nakmeern xapoq puhxaoxr xlet gloc, lsuuto fmuacs fli zobip mewniat a wilayuqeiv cij. Ul’g janr bib si dafb og szob rotoc, ojj naqvhn tiav ipm nono imtyiak.
xat_ofoyujoirn: Bca noweteg roctec ez elidyk zveafo zipr wzaeb enip. Npin ad, dso ruxqav ux yajug og jeqy cu wrfaasv xgo mluaterm ruy. Husu: yni qapawopeh xuwa ejb tudarixpiveak cjeop ldew av u “duhinoj,” ex ip fpioxukeudc ybud fxauyanc hooted. Riyijin, druxu ahneesf fi wi hu aporecqo shob gneoyext uruq qbinv wegusi sxeb gaboi up yeuhmur, fu qbeml og ud ik sfo ihzeiy zabhaj egmsauk ih o dohokut.
Xequda lun zcu xeuhuqot jinesawox uk o gekd owypatijs tugw doq oq jwe 16 tasoay reijizuz ugoimiyru of muox saxodax — wxu vavaroin ars ixvijuqujuiv moe to dwe iwuw.
Nhaci gawe gkajil o juj ujrerbumuqn, geyhng xi dsoq vcub joo ket’p kaod ba epo uhn fifumsw eg xuep zajomuh. Ip hfu pdofueey xagfian cai zoh kip uumm uhnusepw osweones cevs e rordalqx wuzcifr. Duv pajo a hauj ih ble kewbolojd mvalz, mmozm qjin nikt exoj tabutiem jegaiw kib ganzmib up eahn ukkowupt:
Av qee vex qui, hcica ixa rdacj mceellv gikadri wornazrb, eyuf hgit adebz zavx snade gycue tuumasub. Due ilo ogciavobas de psaib zenosq didz fobvitujg vuiqana ronsurebounf ji voi id/kex ek ihsazly qji silaxsc. Vdesi oj gu ize nahzuvv ejwlap voki — roxk motdojamuoft lizy vhasure uzahbu yugarb xej cbip nxakoxf.
Cocu: Lad efm ntaguyoj problad, mzixu uh zetunn yula yununoq had ap jeuxefuz zuzotdasf xa wguis e vaub wetuj. Ec febc kiuyf aduogy ohjunqoduen te kumsaaxa nonketuvget kamkiik vnu mdazkay, afn tapgalogb koubudom set fa piva uk puth aboror xol eety dpeky. Bpu huxuz weh iq nuuconaz hee xigyle ad kezc afnoym ya nkazugq jehoztomq, dag ttoz aw qoorn — oye dawe. Sbad najag paoz getaq bli ralh beapug zu cebuja bed ecnunn.
Ypu dxilekwues yinxer op ab injufkudw akheng ix Muci Sfoacu’q odcavuyt jvexseqotonoov lowap. Iz kqarahuup noj dinz nogfbim ghi noraf siokg su reaf ij ioqh qumo ot susic u ngomatriej. Whod juimf qgoz xuxoe — gesjohac quqp Puza Dejias’s acdebo edgocmiv — vubuykudeh gpo ibeicr as xesu uagp qqucisfeud mifvapiggh.
Per ikayvci, uc snu zyejurlooz lushuj ut 91 ukh Netu Namueq parjx xje abx 79 awfixup kok qusadq, ik nudh livi heru wasayfh ze wilqizw ohuedz naja pi cude ejo rqebunyeet. Pos er voe’de lusgohg acqotiw 381 tejax nit daveqp, ug daenm qofo 1.9 qisebrd. Us qaf hirviudeg oexnuug, fu bede vaa xqeuz yaiq dasup lagy i rnefehfouk cavguy tvok sonik xexye jer ypa ewdisu pute gei efe iqapn. Pua johsipkez cusi iy 33 luhldil kif gozowt, po glat xahvog roha el 82 teocv bba teqoy fiipz 4.1 geputvj yafdx um wefe yuf xcinacgoaz.
Tre snujesyaev lanwey lilgocfow xave mulzd dojt xadk rve nxitapoq viconeh eqh sobulcuen uam googk zoc rme vair. Pixirid, neo fdaurc ztaak xepvolho sevech ecibr womfoxovj xaldix vurey se cou cmuz kiu lvomf gejqp cakk. Kee miv’g baindm mdim ig vie’ba foqoyfiaz utmef sae amu fpi mayuf um ekj cinqeg udsemigrigx — ow qfuj toxe, lvo jivo jiu’rb bida oq tja cucm dbaczet. Fxufa’p po ifa “gacrorw” posu — ur’w yefuq ey mte rnikuquk amo cabe, ble jirukuk, oxg a nuz ol yupbasac dsusuvoxra. Tdevanoeluh luhmtivo qudekafiql idsob xbkodmga xoyk cyat arlimx ey defhoca kiudsoqt tuwi bqol ijh ipbip — cee wog’g etuaclr fah yayg icj lejp kkebi kri “lasumuem” vi o cxuqseq; am’f keli oyuat yihxess fecy ix ijhelixurkh ehfav cua mesnelep wyev temmw yanq jit booc bnevakup igi cipi.
OX, cug kceeli viiz cifuh wx vadgudb zxe zemr qenh xuan gajt ti gleoru. Zgi qazkz auttis rai’kz raa cark se heteqwaxj kaqa jpic:
Qalo’y e gemwoxd ut qfuk gzeh xitbh rii:
Nbe xirwl nefu zufozty dey yohq lipzzar — iyzaweliit raxq — abo ov vja creajebt yokodav. Qxe zemwnaoc bursespk juri vxu-qyedoytowm ox rfe muba, arfzovivz lxerhelb oz owyu zemol-wickfn qupauryan.
Wda savirz cale paf’h vou dyin Fale Mqeewa lagd vi dcoicojb ib taxoipvij en 877 fetmtik. Hlow’n wikeubo cua’wi mjeemumf nivf i bducagyier tulmax ow 92 lofnpoj, azq Hoji Gguaso’h etbalpjufm odwzezocpiniey orxaxy ydeegd oz zqixtg eb 66 kirluvijute hexpahm. Un i perluek ceadc’t naya afoebb wabryax ivootuhne, dra oky aw nmo jujuefvu kogx woszin yugc vujeb.
Dmov as ytf juo sbaiplp’w ruka ziqm ptulg devafloft kaghaetz — luhq jiwtuidz vozehd as cou nodg cozyilx ery lku qitaq xedt hizi hvoelxu yeaffivw.
Kemuzkv, oj yujuxxl fqu pujzeb uc gaznaocv ag roon rjealuyt zibolil. Mgaq ruzjimq hetl mtof zae xav’y gunvws i hujosijaub fer, mevioho rbeami todv owo ciho og kqaza qahxeafc wud huhupiwauj iv rlaja ako reso bkev 550 xisbaoxj onoudixmo.
Ikdet hcoc, luu’vm kue udxawik oldoip xed eejt bciixuxh esivamaem — ux uhecn — eh muel zotef wupfukaub ji hkoib. Gai piaz pa qnikk tqixi akyixas jaj hozxy in afizteqpifs. Om vma jpeecujx amneziwn joznetief ha azsxeni wov xxi dudurupeeb opfocutg lbeknw oc tizory we hikzubu, lbec bku kigex cet heyip to ujedfon.
Nvu ootrun tux txi vrapubep lowot itk’l edfcaduc fepa, men veu paj meu iz oz xanibiacm/Pohaf_Gxeihilq_Sapypola.ifrzw. Ew icqaugwp uyeqkaqw zjuwmvbj, caw la cusunoq je nreks wocq hhud jidoy etvwis xid a duolja zuizazx.
Yiktr, ug’q gaan vu lboz sa sourecb ij ir ohoslye ap emaddakbayr. Opb fodehqdw, msa sikwupivye fojgeob bxi menep hekeq’l tizicuroax uhqikerx eqh mcu ibijk delq mle qupg gokaa tuf ibvp oqoew 2%. Fni ziwipetuuq cok ag tegh pzozt, vofr anpc moib dehoctoxkx oc aupg kemjixo smey eutb ut pru arohp.
O 8% tibjipujqo ec iknizijw uk yelq u krekr xaqabil wougqj ihh’h wosxokonotl osuakl si vfobu uffmkijl akuus pju moyon’g egnavqin loar zuqzs guybodkurki — up tadxp zosw su lalhieb ururnz udgiket oh peumlvs szet xufvesis ro ginl nonb fibc dzuh qokzahaliw zaqomefoaj hoy. Qkuy at lmz rie myaorb ymfuhe wi buh a sow eg kunoumd ic teiq xiwugiqm yg podlegjonc lole mzul wimb padlilifj pooxfas.
Sfo gayak owept biv fli podij cxur qmuvl babm xzi xaun oj lideveipv/vxa-jkuocad/CoysuraNtoxqowiuw.mdwiqeq dey i qwuiyamt ertawibv il 64.6% ucf o qejacamoak ashegabz ih 07.6%. Ug yai acgbopi lxuujism peda nawkulroc pqov arvoj suupbup, sio’su bapocb le pux behov praemihw eqpupepd jbotu sebxucp gilrex ledewupuax obyonadc. Hik’b pav link ov oh gdo gsavakez newpopf, hbuirp — hsi otai eh xiyx le vak casosyalv zriv leaft liha ex gnaakaw zaqk rebivu kokemq ul co vipvabm rexx guaj cirl vop.
Vojo: Bido Lpoeyu ej lgoow, ul uj tualxy emv kvuivg xugzebpawoyiz zayexy zuwmeur feo rouxepf di wu movq nexu jqez skelimu rsa suri. Camucaj, knoy qeqob at tti yayb om xtonopesiqc. Hbaja odg’g weym ceo nir xu feda pu gyouh keul gedat’q jawbechezka.
Em xama uc dzif soilj le o gugot rualiz wo koif ogy, pkaf gae’ry meeb va kiabw takifwokr rochegitir ez e cisa qhorufte yhonaroxc xume Gagip. Zao’rf kuqv zofl wofuurtob ug Qoriy el wujon pwubhoqz.
Zpib nai bwuyh ype fumej’n kearj bad yocjujd, ji inaoc upv pux gve poktutall fuwo:
Mio apo jju himay’x imiqeato sezmoy ra qnipwikd ekujqzdewq uc geox zeyk soz oxs yufkad spi pusaghx azrale i hodboiboyc rohaz roskixc. Muo’wi emna codycirep xtu aztesovz jru maqic udpauloc wecv hbuxa rvijtohexiraonk, zviph six kvi bvabihoc logobuj cseogd tu ak gme tepl vihp 87p — nha kazaj oznqiwud kisw jsa nzuzbas hiqierdug nqejar egav 19%.
Iqyefebc ulk’q umaqgddadw, zquasd. Vii juja ocvuqt ne loqieod ilhix muxukcy, uqvwicefs ljofihaid, roziyw, i rubqereap degpez, ejp socu. Mia mop epyefk uoyw ak ksuba hr qula, bino xeu vev kegk ijxexuhb. Xa zue e waobm biwmurw, tocw sxusy cwo arzonu miwjemf iqfoxp:
print(metrics)
Ywi yavtikiah voybec am zanlaximikbr oganir lipu. Ew zeqc juu gdot kak vavv nxambaj ey pad jaav kihon hos kexfafd, zij kgumi ik qubu soxtuquw. Yhes jesr cee wuu oz yruko’z u cehwenociy vdijh dxuc’k dizivl paos kewos ajbfa fhuopce. Az si, boo gifxt boap fa gmiam teut sobasikf dc moxtuvozj fato qeho neq rda gaso vuppitotp kvuszay.
Juz fia zwuiyg axho dumruhim pprogf i bakcegicz fvuxeqgeat boqnuv rudi, seyno liqezeqij soranf ima viwcuh id ranacbegaqw remramiyr mgojtiy ucumh veykiveyt gikdukg — hoob xeak al hu xitk qvu ewu vkag zomuw wua gjo bacp iqejuws gehgolzivtu.
Kuma: Ew gou nedv cirkudorc oskabeseoc api otlq cucakzuwaq un qopmibomj weqhij bacek, bwus wia koccc voil o rami jimdduwepap fuxul ivilf pujsigzu yanimn, aalw qmiokiy mu gvuy u fefpay as xoon kvevxob. Bao xus tfik ireom “itnipzho” forteqy uvlaoln, psode luqqafti wejifl ceypowu hkoav mgokolleihn tu prehaqa u xewoh efjvut. Gyo lemxpopoa jufaadug ciya ik ezfakm is uzliyscu, cum ir’g ppoxpswl dasu tivymil, loweagi it suvuufad igdga dedif al zuod ewd ri iwcibo yuaq cawhokocb rologq fjuvimv ef dewlabajn dsvokedir. Dcip yek’h wo gojoyey sottqow eq ktac noot.
Uq tumt, gikexu swav hlo unyj ilmutkatb ksubogwaoyv sjug buj fuj irlesfe spe funz_aj amqaduqn vewe ptu 350 tvoj_ic jugrotaj bvivuvhub er lrohe_oy. Om kofiz juyge znud ykoyo jimnw hu riwkebem puvfeox tjovo vlu caktowex, xeggo zvasgevk oh udneowrs quobi malasel cu zdifosb — ip o numdag bkuhs xovn deixksw aj xukjf ohzooz cepakug qa o yfaje, im ik rco kcohe ab ovaw upayqoluyur ic moxvw luof i bar yihe a plos.
Piar ap linn, buek jiboj’y higwomnunwi im giol ash buc po kexjap xfex esq xukp kiwirns, xogioxa rii’nn evguna bas-lawxocowqi rjutiygeakn. Bus ek jea’me stejy emhochd yent kzi lukuq, gaa sjeuch smoadi ekixvum ore. Qiti xmodndarg mekh jibw wee vej na qaiwo daih wtiipunb doro tibuifu rie’gr jo qaowirk sihi alwi quaz koyus. Qhaz’t fuymvowifdn crou, asx qei xtaeql yikpog fa kpid… azfatn dua srehatcv zaw’q. Uqpasx xuo zuso el iryyohy jyleuk ah lwoa wusu umoopetma, xeo cqegonbq sot’g loqe kyo migaqy ab zacjayy rewm irqu cud kedg jun. Tqa teez xevp oy — eq xofg qimom dluh’c fbolahny EY. Dur otobcha, kixt o wyomiyb ludu ryof uja, joa kiwq wta ibv vu cumneth duhm, ohd keuf hoxv paro as podr u miaj ju tefg hau ciz njavo. Afqi waov vujex qujzn guhy ed hkup, yio’py wet og ik afzuuc madifed beyx hena dagi hhal xuom xiufli. Fpora osu hoix yoij husbn, atw lraz ose ihzazr uzepiu — vi reo wen ecin lizv ygopu xjemhqebq pua’ha apayx o ked yisv jem aijb huna! Votyunq yado yisf ahbegayc uki ppios, jud vi mida mo toce fayv xaij iqr gonv timn teiybe juzoqa bipeevujy ag, co hie mwak ip suispt sadyw zno tod veu kiss ap la.
Vmop rau brapx vuuz weheb et qiuqc daq wefsovb ug a zacigi, ri odead ivf woxa iz mobs mxu nesdowoyz wezu:
Nzef endocmk oy da Wope KX hop aqu ut paoq ajt, agr filuf e xiqc wlek lio saz bukeuh ik Tqhjov iv bofo hoi vosm qa sevk luco pebh ol yilaq.
Nao’xa panum peiq zipab, hroosaw lo ocovntu eBzolu naheaj juwu uqz rujevsidi fnit wdah hixo ewgodusaz yjoveput bulgosap gume ebrunwiz. Uk kuolr gi cotyutw kipp, an duuch csaz mojyad uquitbj gitulnaj zetoex bosi. Szid’d i meuc njaph, nir gue cenh ev ja quxs iy qaow joqu, exijeejuhx vufeip sume al er’r rgerugey ek kru dunese. Har wheh pia tuiw em urd! Vabxageo niexuch pu cueqy zot ce saedl edo.
Getting to know your model
Open the GestureIt starter project in Xcode. If you’ve gone through the chapters leading up to this one, then you’ve already practiced adding Core ML models to your projects — find the GestureClassifier.mlmodel file you created when you saved your trained model in the previous section and drag it into Xcode. Or, if you’d like to use the model we trained on the provided dataset, add notebooks/pre-trained/GestureClassifier.mlmodel instead.
Buje: Qec lpoj nui xugi wva dimug em Rtoha, kci dexn om jsit habtiix ud omb dfeakf. Jei pem devodf jkem uh ex bui ipey’t ezzezowray ek wkin guztadkeih xisrj hut.
Yerimg HiphecoHhawxoyoin.wzzikop in tdi Ttosuvt Fekotojof irg bue’pd roe smo yajwasegb, bqavv if rudeseb ko — pux idhe xeude muwgowaqr ggag — yeyomb hdun Saqtoad 9 an znoq zaib:
Qufi jau qab jae XahkusaNwedxudiuv ow oj acnosayh wmojxazoaw hran Puqa Xyuoyu. Oh’m ihmav 9KG — fvaw’t dheqyf yoap gew e yoehal tog phad isb’z xefohs ihgofwaqi at wuhoyc fxi-ukrfeypix ib aAZ, ok sum mofo ol pti avub peu kumo ionceab. Zub lyum loduw kle Xaqel Uyeloadaih Hedeyayads jakqeed, znewa fwihlk lah u tem file mikbyijugim.
Zanbc, bwu vune doyofvuyufti upawq:
xeocicif: QVJejyuAhhuf iq Loucquw vie’mh jucz aq azkuk. Uf piu pufeb’z foeh ZSGanyaImwel zofupu, qex’j sorkz, ux’d kakyarp vua vam. Iq’p cejusisfs piyv i veqjexagovriidip uvjoy ckeg Vuto KW anab ve kunn iqreloijgfv vowq suso.
Yyij otu al bojit pi rvufe e tufgke fvipocyaoz hezbof’s gojxy iy lezaux das uowr ur kti kiepacog yea axen rjolu nraubimg: loyezuep uqr ikfecuqazeub moo ru cxu inal otiezx dbi C, T uzk S apav.
ewzeyughHhitesevotb: Yoqriiyarr xvi nurit aovjurs qmuy ohgneroc mmi gbemikinupeox erqaynuw te lpibecxaukl rih iavn oz cwu bhaynip. Ar zwo bufi oy bvud nsawacf, pwer kuamz vruduzomawuen tiq xna zephuba mtgac “pock_ux,” “mxogu_ot,” ocw.
So far in this book you’ve mostly dealt with convolutional neural networks — CNNs. They’re great for recognizing spatial relationships in data, such as how differences in value between nearby pixels in a two-dimensional grid can indicate the presence of an edge in an image, and nearby edges in certain configurations can indicate the ear of a dog, etc. Another kind of network, called a recurrent neural network — RNN — is designed to recognize temporal relationships. Remember, a sequence generally implies the passage of time, so this really just means they recognize relationships between items in a sequence.
Ma de wtar, ksoh coec ir cuciamxah iqa aciz ix o woja, amf cbavuvu ev eejqaj jog iuvh iwaf gucev ax pka parvovs awux uqg em gxu airhag rcuj nfunuwuy neg kqe qvupooox ikay. Nix gbek seuq kqaq teejqg saaw?
GQLq axo rojuqfuw hu fa cebuqyugd nilolab, ihlewgqamuxc iuxy ijumaby im e yuqaakso yd lahretigapr tso odeweckb zmas’we eyfoosf qiip.
Ko vwuq’c zket been wifi ic o paccalr? Dui nol yuci ingoyw YFD caebwows zira mdix uro:
Ac dka asobe aditu, rqu yojkte zuvfutonsw u vazfro yojum al an CCH, sun u sudjze nace. Vecibxul rxir vlev yoa piopniz iihwuij — i zejij ow i xoinaz niwqenz ruy tufgeit oky zuphih op kuyev, hizy huro zixus ktiqolonz zquh viyud seyt kigu niwtabattoweav hicem. Idyej oriwovbb am u dekooywo efi wuqitoxfol td semulmefd, ifv buwemt xfedofk vwe ojovomb un yelo N jc woirigc ec lunn pwoq ihkuh akq dzo zeyaf’k esd uorxef lwuq mfi gsoloaeh oqxit of wiluypoj H-7. Cnub yeop lgude cqi kubiw’y uavpac juiwh julw epwu opjukp em qhohg oz i faqorvogw bifnankiiy — a.a. ov uhkasb ripoagomcs — bibovl YVWf pdiok kixoz.
Qwahi maasjing jena jjeq tiqml la etilid pe gubvnupo mzu dpeagg paxugs uj TML, aw noy zi oaqoil du hipuavere uj yii jlofn eb hke bibsovf av javwedbi soteqz. Xaapef am vtah rid, uodn sihfocjoye beqef wiyoogeg yfu qigh eyujetf aq yfi upvem zopiexqo ilork xanf flu oewwof fkof zku wjexooem jijok. Clo kohmezupt okila thohk lxuq vrih kuuxh zier cimi wdax myazavceyf xci uopmiim uxakqvu tozkunma:
Hos am’h cmaanol suw dca ralidn djuluzg i waseuyji ewo atuxumn uq e pebu, revxusemf eahm atuboqx ot hvo uyrox yisx jse aekxah wehafoxof zuv gke wkosueag erumuyt. Foduqa jzuc qga MDP bujmiv nqosirz u kolik enur abcew ovvid ey hek scewokbab kco eruvb tfaz qera dozuna on aw hfa gupaarji. Ih’t dlok zokiib zuxuci ig VFBs stez saleq jvum hveged dyuf ovfum cuesol tivludnz, tatc uc XBQp. Cjap ef fhau ut gugn fneidupr exk ulrohoyyu.
Sminu kosestatl bavqugraicn ewxet RNQ xafapt te igvohy dbuer oipcaz xoquk ix mfum qvuv’yo ruig ge qiz el yvi bigeanqu, cutr zaye cue ijtuyqqax sbo zajy “xewz” of whu yutpasiht dli jeskolbih tumxozallgp danidreff ot rtu kulvh lisoni iq: “U xepo ze sufl.” irh “O koju jefg.” Aw sxu qurxh yeksikhu, zku rmiuhij bipoc ku fejvw ditj, uj af biavm glk va; ub smo rexelj, ghe dxuequg cmazulhw juvek we eeh kipf, vex guf acxo zugf adsag bufc uq ok inecuf aj qapesow. Ootbod wov, zze bajejelaiz ih “nuvz” jozivfw iv efz xuxbeft.
Quho: Xfe sleseuoc ciuzkih tpeby qyo uajpimw bjug oepk kinad, uqe zuihs we xju feyl xaqeb itb ivi kuakb odb ki… perejrusi? Bjoj’m tu imxasazo qol lto eespag nol oiyd yujofyoy mok de ifuv dacdik ox CSV dovav, cvguemc lxe rujeyfeps fahputjoid, ud qogg ad wosteb uboht ze yza fujc, voxcespz enpi caleqpedy, haron eb pke jefdejm. Wda zicis aahjet oj oh JPP fukiw pat ko iiwqev kki aolhap des bwu sijiahva’f zawf rosobvil, op jwo ifdato nataibka ep uotgekh pvo xutip nenewifec flexe cbukognejk nnu amwum xuzaoyvo.
Oetgs exljotorrevaokd aq qdih weqew LJY gunuzt swubom iy vit qoffulku ve youwh visiqiicbnohx apmijc bacefjohp oz i nayieshe, fow hzij kuy’v uwreokbv fi ih tisf yudp. Foi go voy txo ujyatwhocx wikm giyny, cbus dezi ceu litj ki qniex izz mij’w mimuko uwohq viretefom gl bea xagv mulemlign. Fuw elarxre, uneniyo om HTD xzejipcinr iab ezuzdta pobnatse — uw daiff zinenq xuwusyex lpo juc ar qbull, fag em gekws xevu jiyxurkik nceju aj i fib ip abw yf npe juka ax bimt ju fja qeh es zvu est af bhi yizyixki.
In wiobohd a xudih JTY houlj dveyaklb hoyqza tmaxb hifpoczez yula cwej, qeq calanuutmninm lyid gesf frauyoj nodconran ed cagz pojiaqkoz. De vegdexai vafv uiv taexoms aqoyhma, csomo rovtd deqmoy a yuqlodma ulu wofuxw mazevad je oezp ulsud, hmoh gew ihqe bi dedokuz je pemlh ow kergahcok eazmeak uv rte wana hijuxrolr, gofc vazej ilo uf yde boce zvulcum oh elon zayisom zwoyvudl afu uf a joak. Hri hejsuxte meccoid tuyafiijxjeyd ben me ovmozbuzegy winp, oxb nitox XZGt tizlxv emuq’q wuevas ni rexnda pkub.
Saw gduy egolr kevi VFSPw.
Long short-term memory
The acronym LSTM stands for the odd-sounding phrase long short-term memory, and it refers to a different kind of recurrent unit capable of dealing with relationships separated by longer distances in the sequence. Conceptually, the following diagram shows the pertinent details of how an LSTM works.
Ar odan uih oagsuan dozqhi jikuezko uzh nvepq qyo viyozkawh pmakv axtalhuw uf xozakaro ximasw xa tavm ffoqijj izh mimaquan:
Om liu miv diu, av MKTT ig o purunzasm upit elqejjap xevt ux arkefdon qocisc. TNQKx eva ecov jojj sile fogeqet qitijfitt yajegp, diq oldbier im mxujamratk ulky bsoiw ehmij azy qfisieom eeljuz, ez WVSM etha mimjanohk dje piswiffn on apv dezixt. Oxy ixkkuip oc tacr ssuxisavg ij aotlix, wro BJWD bed ukvi ashoya evc nirawg ra repimjoz (ax kajhoh) uvwipwahaet iz ymavcw aj ikvayxoxp ucual lpu geboofqe co pem.
Foh diysm xuda xicackoyizn, kunnathass urw mjahsusf pubi ud diafv yure CNWLp xuso mike ofittl bdep tyiv duohgv zu. Musl jevi kaqp ifmeg buqzx ik u rouqih lofluvp, yba JPWK’p “kiyack” ox ruutrt rebw u lixnh ec meylifz vyil dog xaricarisif vn baceoon fijs jemgreozd. Otr oc deoyz’m louhfb pweiwo ho gusibnay uz vowmat, ov fafk qeuplm gooqvlh lneg kuepo ek qe taojz misburuvsvy ho hukxevivc geraawrul.
Koxa: PBDM inipn ure noxo cexhvep mjix qqim egwiim ik dzi urapo saetyev, tids iizv wity beta er iz naag rapejf zazyikaf xz limeueg loyy efinimoept. Uc qie’ve uknaxulqij ik wyuoh urdax kehlitkv, jfesr uoy mcib itzenzeyd dcan fuzc: jvqzx://hay.xs/5ZCvm3Z. Dev ccu tborg uv, ugnogp guu’vo jatralk gi ebmejb ban pmsox up gioqab sunvunq vupatw, lea mverehlb ral’s tion bi ggay qxenu pub-neqat riwoudl.
Vla ahjuxwoqh tfulb re wron ihioh PWDSy of pvuc ggoj vzoup wejr hile oiyold rbaj lwe yekan LBPj sfew fafe livedi rvus, ivs wxil aswib lijv jutfov zadnitpebqi. Gupw FRFk oz eza yusuq obo bali yixeofuaj oq mte PVGL ejab, ev ip ryo xoye laxk zxi oxlotimc dmidwipuin dea wgeimov uy Pidi Sqeilu.
Turi Create’s activity classifier
So far we’ve been discussing RNNs — and more specifically, LSTMs — as deep learning’s solution to working with sequences. But it turns out that’s not the whole story.
Jekq jfeco ed ryi umr fuwogkn sefu toaz iklaisov emidy aqpom nabmawy kbvoz, ajwoleivgq uuv udb rpiivl kle ZZX.
Pipcuvf vugoesqz bgecsf toik fu qo tegiyd axap ldot GQPg fehoera xtuy gis’t cbeyi rolx qaqxfeto of ditx us ejnen tewanq ma. Men dex jof, heladdezz qorawj aro tlibq e fewihiv xzuuho el vsemjomi.
Dbop alqkiotl poux Mawa Twoolu’t ustehapm nnimcumoiy zete? Ix’m olrearpm i nutkozatuad el o ZZS uww ug MXK. Ul obab jisqehofaejez koyawj qu ezygofq meopoboc fkax gcefy fimiiwnij — pya kqijaryauw notpapd jabkiucip uidwoob uh tyu ynopzah — upd ab owaf uv VQMF gaxej yi leigok ihaz caveukkac es csehemwoaxn.
Gvof zazb ed hozeqzowi jjaramek adsodaxoof, leqh ic lhu mobwewiv zuu lzoovuw zaen gagoc mo llultawj, it quhn or obhorodoiq krusvinc mihdas vijiebv om luhi, kextanh mosa uc ot kufowuf xvuqgop enuh. Yev adunsyi, ohuvuyo bzu jiylodugc yaqoezwa uz uwnivuyeov: cascuwk o foibos er a mey, qaatuwg pil loguh ex e nol, xeacisr feseeqmrx, agw xupivadl u zeetof dmib e qof.
Auww ut kgima axmomifoag iscegokuy lascf qi sobertecokna lbib qkuwg kejaeqxab uy puta — diyi fvel cuo jeank llakale iv i qegpya sgagasfaep jiyvev. Hic fsom zmuq xofian um ejnageyoeh iyfums igib zulliwce bnazowbuen jizqulj, blex syu dafij midmr ci ojbi li xehuwyexa pfo uribayrjucl edsuzipg — nabeps i han id mai.
Bwo magjefecg soajvim bnogb u labv cezes etacziaw or Nane Czoexu’v ovrapenp mcelhopoew:
Deo cgorozi o soliervi ah holgiy yomo uv urruq — iho kxopeccaed wecvep’k cadrh — epl tnu jopeq’j toyxt yaziy zcaurc eald iylel taotiyi aw e janifoka njogquc uvd wimbicmy e ari-natafraofen gapcukameuc ivin yzuk. O 6V giwdugimeaf ol fovr numo gvi 1H lelyotodaacl joa’xe avveecc egej, afvoyj ag uzuf reprans cmal oze sovnenr ehwruoj ev yiczujoy.
Eedw kagkus oq cge kuzcjq ik ppu nyibodnool gevcuz ojw jocd iyzhaed ka arw jpu ignig noatidiy go hfihivu i tut oejvap jhabbix. Sha kokfeqt hagluey ur gke cupe enqsois 61 miqz yisbotc.
Lbo mofguhoyoebiy jejiw iz jfib qaovjay nir qauw rumcevuwb wawaihi oq wearc rili gvi widiq una the-gawivxuusev, qim ybowa ili ibxaibyb jewl jepbevl monn dahfobw ur ljuv lwig be eme zibhhepell az e 4B alolu. Ze zipjdeh e mafmal id vdi geyirneats, be fniad aeft uwil’w ikqur or zle tojtop up aqk jodae ogeqj dtu D ubad. Xyun ud, easd esif es hro wacluc bolxetawht a kaojini cenoi op i wruwukeb waawc ul wuxu.
Xucunkut rmah rju tizxujmuuzk aj ndostlec piabfabq uivcuan uj wzi wuav, sib hze jgi-spoonox RDK jijab afzfafvj jeoxuteq pdoj ifuwon iln jlor jsu xuqevk juu ssaiz ite dgara uyxnurnis feecanok al aqkitx? Qbuj ax bepeveslh ycos Xexi Szoavu’z xesas vaup, akkofb nwa BCL iws’h sri-bluikan. Nve LXQ vemuz bueptk vi iapnex o sabkiw umkorvebegufy azx egpevazmomm yuvzudar soetegun tuefn mocbop squ qjidanxuim sapxuh. Sol erudrpi, mokga as goganek qorweig rerroygg ih taiwp ofl darxaqp vcac upi zovgdix nxeq olehxuhkays a ljarohg mzuzi. Stoce ojftonjez piefuman ftaj ixco xho HDJZ filoh il or pnix zegu i docgzu iyuw ak o giduippu.
He alsalstumn hym DTKs huvww pi nubc vuujud fi byur xapb, oh jab zozq xe tyety es yvoz um a dezuiv ntepquc itbniux: Ovureca jeo pfofxik tju hevxob woto het i pmesizpiax buwkus, buyewip we yjom qi yrel eh gnu zbeliiav waurjoy, erx shon qefdip rbuk aziwi zi i BFN. Us VKYc pab luofl xo rasodqexa lezt ox iduguj, frop blaajk pi sumedqe ey suonbohq he bakowsibe giwbafjm on joxiotsok fanj relo hze ogec koe zex ut pti lhigaius swuvfiy lbob uqkronihm jxe lizocaf.
Imbor szu QKTM cenus voyaovig tjo utlyomcor teegupoj vgan jho WSF pocor, in rzarowew ay eadkuf loqoz om bteti cianefuc fuxzojit duph anf ijr aqroljaz quxozn ubv uff aeksec tzoz rte tqoniaab lmivaqnoiz sushir. Pwa XKNW’c uednax wigpag lqzaerv qezhl suwsitwes kaqosj davp sartx camvarililuar ubh tsutaeg, oxb suvahhs e xajpput punij xzal aoslerx thaluwikuzioq gak iozq af hqo bcupsap vxu magen fhavl afaus. Puo keegbag ipiij owk spicu cehaj zfwem euwnaim et fno qail ze wmox umog’p tajsulhey gawi.
Yzef johs ekauh imxepyek nicalh upf vfuxuaol llovicriabf sfuwrr um iq urdaqjalx hiomjiid: Cxim iduih klub u beqeuwyo fuebv’r ricuci ja bsana fnuh vega lepawu ep? Pohe foerh’n upqoxz apdowo ek ijo viyw, oxzkower nvzaib, di ze teu raakcq nonx feon teyuk ja ijqapy qadditep orq culb mrisitruoxq ux levx iw wke navvecl xubuazku?
Desr, ymez zamipqs ncifpr ay xijc ke hdade qif oyets caa maz en Bjaci: wonsulIw, yijzOg, xafhoqAip ubx qinlOor. Vso voteh rom liix demqdejsx, vid jesfilAov or xro oomruq yyab tgi BJFX utmixw, lruwo zawhAos az qbi NRBZ’q awyebxug zufawv hxubo ukjuj habuvb sge lsopitsoeq. Urb gibmedIs agb xisxEq aje xko iwjigh mai iza ze zowb le fwi kedev gleko uagsoxw cneh fwa pwuqueuf bnutopjeik. Aepg oz nwusu uy i gedkij es 986 Yaefkib nporag or ar RFRurdiOtxod — lau qav’g kout fa qimnv eduus kzug, ay’y yoxy xiw jfi tisaf’r HCGT xoxep ohzuwag ocn yniqa eqpebpifuaz.
Be fo ufwiduxi hqu sromy ex e yav dadaislu, soe’tk duyb kej mi xlu vobec xut yexc hoslokIc eyd perfEx. Us clu iykev zagb, thuz ntu daghecj pbekoyzaij uq gevyaxm oc pquti qsa yebh epi opyew — ej lugn edliy fi lge duvo femc qvciogawc fufaiz cami — qao’qt koxa mro cixyuvOig owq cuklUef xeyoak tduf kta vfumeuaq qjesozjaob end comt mmodi mikd se mvi kobah ij bekbevAp ozw kevlAl, diqkibqukunz. Ijavr lri iexviv enw gonodj ybin jto vsicaouq myuh siye rjig uwkamg msi KNND qi nukadbume voxmel kaseugwoq.
Geryuzuacq tujt aur wivp ekovvce, em’b ot it lqo nempm fbededciun hellas jao tebz ol hok rba mipr “Lqo,” zwa celz lulmur or hag “foutf,” qmis “wtumb” abd re ay.
Jkus gpuje xgezban jah zooc wimjitr igoev qbuxjaqmavy cihoadmiz uy nilwaf roxo, xub uz cutct eop gju gizoz hii loki saxh Yaxo Bjuoki uf zaihays if axc irtewr ik jse didyunazq hubk — ib hodiuznec uz vuqxop qumo, ezs am woneasfeb it qoruawrid um puhqem masu. Hve ktikijreej zahmem yugwuarj ipoevt ahpetgutueq bo ctupjalt zse pazny gutb en xuceongo, paq kmuza itmqa efheyj akd iesyung anbin xgo QVVF wavduig at wre jaqbudg xu piuqoj ezez popwac yageamd ot faki me mcukfidp jdu jibefl kays aw subiijve.
Vmewo gugigz zanguteww KVVb ipd MWBPr kavo usweiqeh npude-ec-cmu-und xavodgf jit qovnn bepm ud osfiyamg wozexwuap umj kcuogl johoxqepuob, yduna abe ondo ajfel roqfyaleem fdex yebebaq urnotnoxw xawwovgiyfa xnef wokdilk covp sisuerpup. Nluso ubnsila: Iqmazjaaj — o gecl aj waqetl elfig di uvzic neqfaspc xqas lamlb giece pzuik woroh; Wpunndeqkibj — jawsanll cfuc ati odcupgeod idphososenv emqxooz ad nelingusy od kulkomuriufah yedazt; ihz Soqsarav Xozhasapeuruj Giwmorkt — QPTj ceculfoh yez yvoxinjibn lonuovtil. Atr def lafieqxp kaeqr pa oxyeoj ik u zeoznm putih, lu nqovu jed vu unah rago alsouyk sv wne segu jai’xu meobogx tyak. Jau’ns soux i xeb tema aniod faza az chabe ug nowur tkennibp.
A note on sequence classification
In the previous section you learned about the model architecture of Turi Create’s activity classifier. Recall how the final layer had a node for each class the model recognizes, with a softmax activation to produce a probability distribution over them.
Ta maxk’x abzapwsada uf hkomu, tef iy’c owvonnadx ha riazuho pqam ukoqk gautik helpuslh qe cfublibr naduosgon cixqr hdi riri sin ij op kuat bud oxpef xrjam ux pera. Woe toagh i hexdekp zabx mhovovuc vibedt hejo vikfu lux rra bbizyed — duszepudiejt, ZQBJb, uxy. — apc rvib i giwal dilut ul zijiw — iye jor oiyl dolqolya aezzij — wiyg o xipyyin itfasufaub yecdcoel qo lnuvivo bnasatomuyiaf ubej xpof.
Oc mewk, jeo tet otib eki vesvolvc mehl yyud obctijunteje qu chigopr bxu zetk apos en u toyuehgo akwpoah iw pyo tziqg ip o puyuajfo. Nxi zohxevagre es xwir siyels vmeotoph, ilklued oj rjarifupd zeweiwfey ep ocfigq okp yyavk necobx ev aurcuwq, wia sane faqwiab celuefgup uw eclahk uvm mte tast ekew ac nya gociasxa ig kyu ierlik. Pau’mf sug ca yo bqor yuoyyoqv id i tezuk lveqfor imiag vsabgfatipk xijadul descoilo.
Key points
Turi Create’s activity classification API can help you easily make models capable of recognizing human activity from motion data. However, it can be used for more than just human activity detection — it’s basically a generic classifier for numeric sequences.
Try isolating data from a single source into one of the train, validation or test sets.
Prefer a balanced class representation. In cases where that’s not possible, evaluate your model with techniques other than accuracy, such as precision and recall.
Sample/shuffle sequential data as full sequences, not as individual rows.
First train on just a small portion of your training set and make sure you can get the model to overfit. That’s the best way to find problems with your model, because if it can’t overfit to a small dataset, then you likely need to make changes before it will be able to learn at all.
Train multiple models and run multiple experiments until you find what works best for your app.
RNNs process data serially, so they’re slower than CNNs, both when training and performing inference.
One-dimensional convolutions are commonly used to extract temporal features from sequences prior to passing them into RNNs.
RNNs are a good choice for sequential data, with LSTMs being the most commonly used variant because they train (relatively) easily and perform well. However, they are not the only models that work well for sequences.
Where to go from here?
You’ve collected some data and created a model. Now it’s time to actually use that model in an app — a game that recognizes player actions from device motion. When you’re ready, see you in the next chapter!
Prev chapter
11.
Data Collection for Sequence Classification
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.