hiandwelcometocodingTensorflow, a showwherewefocusoncodingmachinelearningandAIaiapplications.
I'm LaurenceMaroney, a developeradvocatefortensorflow, andinthisepisodewe'regoingtolookatusingJavaScriptformachinelearninginthebrowser.
Inthepreviousepisode, welookedatcreating a verybasicmachinelearningscenariointhebrowser.
Youtookdatathathad a linearrelationshiponBuilt, a basicmodelthatcouldpredictfuturevalues.
Basedonthatrelationship, itmighthavelooked a littlestrangeandhowyoufedthedataintothemodelwhenyouweretrainingitwithonetensorofthe X valuesandanotherforthe Y values.
That's becauseoneofthecoreconceptsthatyouneedtolearnas a tensorflowdeveloperisallaboutthat.
Howtoshapeyourdataonhowtogetitreadyfortraining.
Thisprocessis a majorpartofdatascience, andtodaywe'lllookat a morecomplexprogramonhowyoucangetyourdatareadyfortraining a machinelearnmodelwithit.
Soinsteadof a simplelineararrangementwhichyoudon't reallyneedmachinelearningfor, let's consider a classificationproblem, andthisiswhentherearemultipleitemsofdataabout a thing, andthenthere's somethingabouthowthey'rerelatedthatdeterminestheclassificationsoffthatthing.
So, forexample, inthe E mailmightbe a spamifit's from a particularsenderorcontainsparticularkeywordsorpictures, ananimalmightbe a doggieifithasfourpawsandacutewetnose.
Nowit's verydifficulttoprogramtraditionalifthentypecodeforthesescenariosonthisiswhymachinelearningcanbesuch a powerfultool.
Solet's take a lookatsomepublicdataon.
We'llusethattobuild a classificationsystem.
We'regoingtousethewellknownIrishdataset, whichcollectsdatapointsfrom 150 differentsamplesofflourtakingpetallengthandwidthaswell a C pulllengthenwithThesemeasurementsarethenassociatedwithoneofthreetypesofiris.
Bytraining a neuralnetworkwiththesemeasurementstellingitthevaluesandthentheclassesofflowerthatcorrespondtothosevalues, youcouldthenbuild a neuralnetworkthatcanunfairfrom a newmeasurement.
Whattypeofflowertheyrepresent.
Solet's take a lookatthedata, andhereitis, andyoumighttypicallygetdatalikethisas a bunchofcommaseparatedvalues.
Asyoucansee, eachentryhasfivevalues.
Thefourmeasurementsthat I mentionedearlierandthen a value 01 ortwoInthefinalcolumnindicatingthecategoryofflowerthatthedatarepresents, Considerthe 1st 4 valuestobeyourexisonthelastoneisyourWhy.
Thus, given a setoffourexes, you'd wanttopredictorclassifythe Y.
Sonowthatyouhavethedata, youcanuseittotrain a model.
Sowhatyoushoulddoisyoutake a percentageofyourdatafortrainingthemodelandthenwiththeremainder, comparethepredictedvaluewiththeiractualvalue, andfromthereyoucandeterminehowwellyourmodelisbehaving.
Solet's take a lookatthecodethatweusedtopreparethisdatafortraining.
Firstofall, we'llsplitthedataintodifferent A raiseforeachoftheclasses.
If I nowlogtheseeraseoftheconsole, I conveyyoutheminmydevelopertools.
Thenextstepwillbetoconvertthesevaluesinto 10 Tsar's withfoursetsof 10 Tsar's and X fortrainingandexperttest.
Ah, wifeortrainingon a wifeortest.
Wedothisaccordingtothetestssplit, whichis a parameterthatwepassintothefunctioninthisdemo, I saidIt's a point, too, sothat 80% ofmydataisusedfortrainingand 20% fortesting.