There's a swell a bunchofinteractivechallengesalongtheway, andthatbringsmetoouruseofscramble.
Scrambleis a fantasticplatformforlearning, andatanypointduringtheentirelecture, youcanstopme.
Itwon't hurtmyfeelings.
Youcanjustintroduced a brandnewscriptandyoucompresscommandplus s ifyou'reonMacorControlPlus s ifyou'reonLennoxorWindowsanditwillexecuteexactlyyourcoatthatissuperimportantthroughout.
Anytime I starttalkingaboutiftheneuralnetwasgoodbecauseithad a lowerrorrateoriftheneuralnetwasbadbecauseithad a higherrate, justlookdownthereandthatwillgiveyou a littlebitofreferenceastowhatwe'redoing.
Someoftheseerrorsmaygodownormaygoup, buteventuallythenetcatchesonanditstartstoaccelerateitsabilitytolearnuntilthatairratestartstodropto a ridiculouslylownumber, notzerountiltrainingiscompleted.
However, brainissmartenoughtocombinethosetogetheranditgivesuswithredbeing 0.9.
Thatredisdarknow.
As a bonus, I couldspelledonuscorrectly.
Whatifwehadtoinverttheproblem?
What I meanbythatis, whatifwe're, forexample, askingourneuralnetforcolorsratherthanclassifyingtheirbrightnessinthisscenario, posithereandthinkabouthowyouwouldaccomplishthis.
Sobyinvertingtheproblem, ourinputswouldthenbelight, neutralanddark, andouroutputswouldbe a colorred, greenorblueforustoflipthevalues.
Let's defineourtrainingdataagain.
Thiswillbeconstantinvertedtrainingdata, andwearegoingtoforBut I equalszeroMichael's colorsaboutlength, goingtotaketheinvertedtrainingdataandpushobjectstoit.
Buttheprincipleofassigning a valueto a neuronwillprovideustheanswerforourneuralnettospeakmorethanjustnumbersonthequestioninyourmindisprobablyhow, Letmeillustratein a waythat a childwouldunderstandthatthisis a lightswitch.
Itisoffnow.
Ifyouweretoask a childtoturnthelightswitchonday, ofcoursewould.
Andourobjectiveistofind a waytogetthesestringvalues, representatives, onesandzerosintotheneuralnet.
Andwhatwe'regonnadoisgivetheneuralnet a dayoftheweekandit's gonnatelluswheretogoonthatdayoftheweeksothatwecaneatfreewithherkids, depositherefor a momentandthinkhowyouwouldaccomplishthisusingthatlightswitchanalogy.
Andthecontextisdynamic, too, inthesensethatwecansay 12 andaskforwhat's nextin l saythreeorweaken, say 34 what's next?
Anditwillgiveus a five, orwecanevenreverseitandsay 5432 What's next?
Andit'llgiveus a one.
That's howdynamicthatrecurrentconceptisinourneuralnettheabilitytosortoftakenthosemultipleframesthat's called a recurrentneuralnet.
Andwhenthissimplestform, thefeedingofforexamplenumbersislikesteppingthroughtimeor a timestep.
Andas I saidinthistutorial, we'regonnalearnhowtocount.
Okay, Now, togetstarted.
Let's goaheadandincludethebrowserversion.
Oh, brainJs.
We'llhavethathere.
Ourtrainingdata.
It's gonnahavetwodifferentoutcomes.
Oneisgonnacountfrom 1 to 5, andthenextoneisgonnacountfromfive, 21 Welldefinedourtrainingdatamanually.
That'llbe a constantcalledtrainingdata, anditisgonnabein a rayandinthatarraywillhavetwoarrays.
The 1st 1 willbe 1234 andfive.
Thenextonewillbe 5432 Noone, that's it.
That's ourentiretrainingdata.
Nextwilldefineourneuralnet.
Constantimminentequals.
Nowthisis a newname, spaceandbrainnewbraindotrecurrentdotlongshorttermmemoryor l s t m timestepnowtotrainoftheneuralmeantwe'llgiveitourtrainingdatausingthetrainmethod, netdottraintrainingdataandlet's seewhatactuallycomesoutoftheneuronthatwhilewe'retrainingitbylogging, we'regonnagiveit a logfunction.
Let's goinandseewhathappens.
Allright?
A trainedreallyfast, Verycool.
Butlet's removetheloggingnowthatweknowthatitcantrainandlet's see, actually, whatcomesoutofthenoblemansoconsoledotlognetdotrunandwe'regonnagiveitpartofoneoftheRaysthatwedefinedinthebeginning.
4.98 Andinthe 2nd 1 wesentin a 543 two, andwe'reexpecting a onejustlikewehave a peerintrainingdataandwegot a 1.0 five.
That's reallyexactlywhatwewantednowas a bonustrack, addinganothertrainingarraythatcountsfrom 10 to 5, orevenfrom 5 to 10 inourlasttutorial, weused a longshorttermmemorytimestepNeuralnetworktocount.
We'regonnausetheseinournextmoment, butthisis a verycommonpracticeacrossnomomentsingeneral, notjustforcurrentneuralnetsisnormalizingourvaluesandmorecommonapproachtonormalizingyourdatawouldbetosubtractthelowestofvaluefromalltheothervaluesthatyou'resittingintotheneuralnetsandthentodividebuyingthehighestvalueminusoflowestvalue.
Sothewaythatevercurrentneuralnetworksisithasaninputmap, andthatmapiskindoflikeanarrayandthatarraymaps a valuethatiscomingintotheneuralnetto a you'reon, anditdoessobyindex.