Basically, they'remadeupof a numberoflayers, sointheimportlayer, a hiddenlayerandanoutputlayer, youcan't havemultiplehiddenlayers, Butwe'llfocusonjusthaving a singlehiddenlayertokeepthingssimple.
Ifitgetsitwrong, willsendthatinformationbacktothebeinport, I guess, andusethattocorrectthesewhitessoultimatelywillbesendinginthousandsofpointsofinformation.
Correctingthesewaitsuntilfinally, wehave a uniquesetofwhitesthatcantakeanyofourgaininformationandgiveusanaccurateandreliableoutput.
Sohere's thepositionofanasteroid.
Whatdo I do?
Turnleft.
Here's anotherpositionof a differentasteroid.
Whatdo I do?
Turnright.
Let's justclosethatdown.
We'llhavetocreate a newjobscriptfile.
Just a plaintextdocumentcalledsayingNeuralNetworkEuronetwork.
Sowhenit's turnedon, whenit's true, I'velostcontroloftheshiporsoonheadovertoournewfile, a neuralnetworkdotJsAtthetopofthatfile, let's use a flagusedstrictandwhatyoustrictdoes.
We'llhavetoimportthatfor I alsodothatupinthestylestrippedcreditscripttagsthescriptandwe'llneed a typetypeFeliwho'll, UHtextJavascriptandthesourcewillequaldotsorrydotslash.
Thatmeansthecurrentdirectoryonneuralnetwork.
Whateverwenamedyourfile, a neuralnetworkdotJsclosedthescripttags, soheaddowntowherewewillinitializesetuponneuralnetworkjustinhere.
Let's trytosetupsomematrices, soletemzeroequal.
NewMatrixrosesaytorosethreecolumnsandletsout.
Putthattomakesurethatit's working.
Wecouldprobablyusethetablecommandhere.
Isthatoutputstabledata?
Tabuladata.
So M zerodotdataThat's thedaughterofourMatrix.
Let's take a lookatthat.
Justneedtoopentheconsole.
Youknow, wehave a twobythreematrixfullofzeros.
That's good.
Let's trytoe.
Passsomedatasowecandothatbysettingupin a rayhere.
Soanarrayof a raise I shouldsaysotoone.
Justhavingsomevalueshereandthenextroadforthree 430 tosay, Okay, let's givethat a guythere.
Thenlet's justthrow a newera, throw a newera, Themessagewecould.
Howaboutmaitresse?
Eez?
Aah!
Offdifferentdimensions.
Okay, sowecheckthatnowwe'llneedtocreateyou.
Nowadmitthatwe'llneedtocreate a newreturnmatrix.
SoletemequalNewmatrix.
Theroadswillbejustbethesameaswhat's past m zerodotrose m zerodotcolumnsandreallytolookthrougheachofthoseair.
Let's I equalszeroeyeslessthan m dotrose I plusplusandanoflipfull.
Let's j equalszero j islessthanindotculls j pluspluswhatwedohere, so m dotdata I jaywillequalorthiscopythat m zero m zerodotdata i j plus m onedotdata i j.
MakesureYeah, itdoesn't workand m zeroandemoneshouldworkgoodtwotimes 004 times 281 timesoneis 13 timesminusthreeisminusnineminusonetimesminusoneis 10 timesheroes.
You're a lookinggood.
Next, let's calculatethedotproducts.
Create a functiontocalculatethedotproductofftwomattresses, sodotproductofftwomatricesthesesostaticdot m zeroandandonenowfortwomatricestobedotcompatible.
Assuch, thefirstone's columnsmustbethesameasthesecondone's rose, forexample, offourbytwomatrixand a twobyfourmetricstheredotcompatibletheinsidenumbersarethesame.
So, forexample, threebytwoandtwobyone, they'recompatible.
Solet's testforthat.
If I amzerodotCole's doesn't equal m onedotrose, thenwehavetothrowanerrorhere.
Sothrowthrow a neweraandtheirmessagecanbejustbematricesarenot, uh, dotdotcompatible.
We'vealreadycreated a functioninourmetricsfunctionsactuallywherewecancallrandomize, waitsonanyonanymetrics, awaitzerodotrandomwaitsanddo a similarthingforwhites.
Onegood.
That's thatstepdone.
Weshouldprobablytestthis.
I gotoourotherfilethathtmlfileandlet's godowntowherewesetupherehehadtodo.
A neuralnetworkwillhavetocreate a variablehere, variable, andthenwe'llcallit.
Andherewecangoin n equalsnewneuralnetwork.
Nowweneedtopassthenumberofimportedandoutputshere.
I thinkweshouldsetthem.
IsConstanceupwherewe'resittingatConstance?
Let's create a sectioncalled a neuralnetworkParametersConstance.
WhatwecanuseanarrowfunctionhereSoexequalsgreaterthanfixourSeymourindexSosigmoid x sothatshouldapplythesigmoidfunctiontoeachofthevalueswithenoughmatrixgoodSimilarlysoforthesecondpart, finally, outputvaluesandapplytheactivationfunction.
Convertfromawarefrom a raintargetarraycangoodandlet's outputerrors.
SocalculatingtheoutputerrorsherethatoutputerasequalmatrixdotSubtractandwe'llsubtractthefirst, whichisthetargetthattargetsminusthesecond, whichistheoutput e outputsthistest, that's all.
Sohowaboutinsteadofcreating a localvariablehere, weuse a propertyonourneuralnetworkWillsaythisdothiddenthisstockhiddensoanywhereweusehiddeninside, hewillgothisstockhidden.
It's stuckhidden.
Youstarthiddenandwehavetogocreate a propertyontheneuralnetworksowecoulddothateasilyenoughtosetthetopofit.
Sothatshit'llworkingoutfeedforwardnowandbackdownwherewehavebackinthetrainfunctionwherewehavehiddenhehas a hindrancewillremainchicksmapthisstarthiddenSowe'reaccessingtheactualhumanvaluesatthisstate.
Atthispointintime, X sigmoid X istrueyetwe'reapplyingthederivativeofitcapitalinDelta.
SothiswhiteonethelaythetransferslayersdotDelta's matrixDon't thetransposehedidn t hidden T andthedeltas, whichwillbetheoutputdeltasofthesocial, areassociatedwiththehiddenlayeroutputdeltas.
Now I havetodo a similarthingforthefirstwhitesowhitezero.
SoweneedtoCatholictransposeoftheimportsinputs t Whatmetricstransfersin?
Wehaveinputs.
Dowehavevisibilityoninputs?
No, wedon't causeagainwithinthefeedforwardwhereconvertingitthereandkeepingitas a localvariable.
Sothisinputswilljustequalonemptyarrayandwehavetocreate a coupleofwithCraigtogetheron a setupgetinputsThisreturnthisinputssetinputs, input, Sequels, inputs.
Thisinputswerelegalinputsthat's lookinggood.
Therearefeed.
Forwardfunctionshouldwork.
Nowwe'rejustassigninsteadofcreating a localvariable, whichis a signitas a propertynowdowninourtrainfunction.
Thisisinputsshouldwork.
Nowthat's fine.
Andwe'reupdatingweights.
ZeroAtthispoint, waitzeroweights, zerodottheinputs, teethinputs T andthedeltasthatareassociatedwithoutofthehiddenDelta's thenextlayerdeltastorunthatmakesureit's notbroken.