I amgoingtoembarkon a newadventureinworkingonlearninghowtouse a lasercutterinparticular, I wanttolearnhowtodolaseretching, and I havethisYouTubemembershipthingon.
Now, I haveabout 100 and 50 ofthesein a boxinmyoffice.
And I willbelaseretchingmyowncoatingtraintrainontohereandmailingthemoutwiththehelpofSai, whoisthecodingtradecommunitymanagerin 2020.
Soifyouhadneverhad a reasontojoin, has a membertoday, Uhuh, beforeyouconjoinedtoday.
I alsothought, youknow, I coulddosomeorcubingcodingcubingwithmybeginner's methodofsolving a Rubik's Cube.
Maybe I couldtalk.
Youthink I couldtalkandsolvethecubeatthesametime?
Canyouevenseewhat I'm doinghere?
Um, I supposethisprobablyisn't what I shouldbedoingrightnow, but I I amanamateur.
I have, ah, have a love, a loveandaffectionforRubik's Cubes.
I'm notsurewhyexactly.
I justcan't helpmyself.
Whatam I doinghere?
I'm tryingtosolve.
Itcannotapparentlysolveandtalkatthesametime.
It's muchtoodifficultformetodothat.
Andallofyouareactual.
Cubaisoutthereprobablyinsomuchpainrightnow, watchingmedothiswithmymethodology, thatis, Youknow, I'vespentnottoomuchtimeinmylifestudyinghowtosolve a Rubik's Cube.
I wish I hadmoretimebecause, honestly, I wouldliketospendallofmytimedoingthat, whichmightjustbekindofanescapistfantasy, a reasontoelikecompletelyleavetheworldinuniversethatwe'reinrightnow, whichfeelslike I oftenwanttodo.
But I shouldn't.
I wanttostayhere.
I wanttobewithyou, thepeople, thepeopleofthecoat, thepassengers, ifyouwill, ofthecodingtrain.
Um, andyouknow, I wanttoenjoythisEarthplanet.
Thingsthatwereon I can't eventalkwhen I'm notsolving a Rubik's Cube.
Andapparentlywhile I amsolving a Rubik's Cubeis a muchharder.
Itisveryhardformetoputwordstogether.
Doyouthink I couldcodeandsolvedtheRubik's Cubethesametime?
I feellike I justhavetofinishthisnow.
But I can't stoptalking.
Wecouldplaymusic.
000!
Cubinginthecabana.
ComingsoonKnowmaybe.
Oh, whatnow?
Unlessyouthinkthat's exciting, I willshowyou.
Nowwhat I'vebeenworkingon, I willshowyouwhat I'vebeenworkingon, whichismynewninebynineCube, which I amattemptingtoturninto a threebythree.
I'm goingnowtoopenbroadcaststudiointothealertspropertypastingin a NewYork.
Wellhitting.
OK, I amgoingtorefreshautomatically.
I'm gonnapressthisbutton.
TherewegocoatingSpainhasbecome a membercodingtrainhasdonatedsuperchat.
Andyoudon't see a subscriberbecause I havethatturnedoff.
Okay, youSonow?
Nowitshouldreallywork, I hope.
Thankyou, HumptyDumptyforjoining.
Whereismybell?
WillringthebellforyearJoined.
Don't falloffthewall.
Theboat.
It's infrontofmyface.
Thisisthethingthat I have a veryspecialtalent, whichistonotseethingsthatarerightinfrontofThankyou, HumptyDumpty.
Andthankyou, ThioNewmember E M s CoFall.
Welcome.
Youhavethenice, lovelylittlebit, thisdotUh, I gotokay.
UmSowhatelsedo I wanttotalkabout?
Sobefore I dotheminiMaxalgorithmandtalkaboutwhatMiniMaxis, letmeofrevisitthemostrecentvideotutorialpublishedonthechannel, whichwasthemlfiveJazztrain, yourownneuralnetwork.
Now, ifyouwatchedthelivestreamwhere I madethistutorialbutdidnotwatchtheactualtutorialvideoyoumightThisisoneoftherarecaseswhereyoumightactuallywanttowatchthisvideo.
Becauseafterthelifestreamrerecordedit, theeditedversionsofthingsthatarelifestreamalwayshavenotalwaysbutoftenhave a littleextrabitsorsomelighteditingtospeedthroughandskipthings.
Butsometimes I willactuallycomebackandrerecordanentirethingourentiresectionif I gotitreallywrong.
I alsosoinadditiontodoingtheselivestreamslikeyou'rewatchingrightnow, I willoftenlivestreamtomembersMydifferentrecordingsessionsif I'm doingextramaterial, someextratutorials, notpartof a livestream.
Andjustyesterday, infact, I had a memberslivestreamwhere I recordedthreemorevideos.
Allfollowupsofthisone.
Sothisinthisparticularexample, I didthedatacollection, trainingandinference, andthenthevideosthatwillbecomingout, our, um, thevideoswillbecomingoutarelookinghowtosavethedatathatyou'vecollected, howtosavethemodelthatyou'vetrainedandthenalsohowtoimplementregression.
Sohowtochangethisinto a regression?
Okay, sotake a lookatthose.
Let's take a fewminutestolookatsomeofthesecommunitycontributions.
I shouldalsomentionspeakingofthings I havethiskeyboardthat I'm usingtodaybecausemybutterfly, I thinkit's calledTheButterflyKeyboardonthisMacisjust, youknow, it's dead.
It's likeitjustit's, like, completelyunusable.
So I'm also I'm attemptingtouse a externalmouseandexternalkeyboardtoday, andhopefullythatwillimprovethingsintermsofmycodingandallofthat.
Allright, overheadoff.
Um, solet's take a lookatsomeofthesefirst.
I haven't actuallylookedatthese, sothisis a surprisetome.
Um, turnmyscreenbrightnessup a littlebitso I canseeit.
Let's lookattheselflearningneuralnetworkbyVlad.
Okay.
Uhoh.
Whoa, wait a second.
Sothisisinterestingbecausethislookslikeitisbasedoffofmycar's neuroevolutionexample, which I builtduring a differentlifestream, Um, andonlyforwindows.
So I guessit's justtheexecute a bowlandwecouldrunit.
IsthisusingEmmafiveoflad, ifyouhappentobeinthechat, have a bunchofquestionsaboutthisforyouthat I'm curiousabout.
But I willmoveonrightnowtothenextone.
Neuralnetworkvisualizationaftertraining.
WaitawhilebyCharlotte.
Okay.
I'm excitedaboutthis.
Um, solet's take a lookatthat.
A B C D.
Also, thislookslikeit's justlikemyexample.
So I'm gonnadosometraininghere.
Canyouhearthat?
Arewehearinganything?
Maybethere's nosoundinthisone.
It's usingcolorinsteadofsound.
Sotheydo a bunchofbees, a bunchofseas.
I wouldlove a communitycontributionthatthinksabout a moreelegantinterfaceordoingthisdatacollection.
Um, butletmedothis.
And I'm goingnow.
Hit t fortraining.
Waitforthemodel, thetree.
SoSimonislettingmeknowthat I missedshowingcontributionsforinteractivedrawingandteachablemachine.
Um, and I wouldbegladtolookatthose.
Maybe I lookatthoseattheendif I havetimebecause I wanttomakesure I getthistrain.
Okay, SoCharlotte's instructionssay, Oh, Charlottedidwhat I was s Sowesee, like a heatmapordecisionmapofallthedifferentcolorsbasedonthetrainingdata.
I shouldreallytrythisagainwith a lessobviouslyclustereddatasetifyou'lloblige.
Ifyou'llhumorme, I wouldliketodothisonemoretime.
So I'm gonnaput I'm gonnamakethedatamuchnoisierintermsofwhereitISSLook, I'm stillgonnakindofclusterit, but I'm gonnaspreadout.
Somemakeit a littlebitmorechaotic, youknow, Traditionally, youwoulddosomethinglikewhatwe'relookingatherewithanalgorithmlike K meansareclusteringkindofalgorithm.
It's interestingthatwe'reusing a neuralnetworkheretoultimatelykindofperformthesamekindofidea.
Now I expectthelosswon't beaslowbecausethere's gonnabe a lotmoreerrors, isgonnabe a lottrickierforittofigureouthowtotrainthismodel.
Butlet's giveit a try.
Lossisdefinitelygoingdown.
That's a goodsign.
Interesting.
Wait, howdo I domyzoomthing?
I soughttousethis.
Areweseeing?
It's interesting.
Itreallyisveryconsistent.
Stillso I'd becurious.
Youknow, I don't.
I wish I hadhourstounpackanddo a deepdiveintoeverysingleoneoftheseexamples.
I'm curiouswhythistooksolong.
It's a veryslowprocess.
IfeverysinglepixelwaspassedintheneuralnetworkandclassifiedoneofthetimeMlfivewillallowyoutopassin a batchofdataandgettheclassicAsiansforallofthem.
So, Charlotte, ifyou'rewatching, I don't knowthatyouare.
Is a littleweird, but I don't see a graphitallMmm.
Oh, yes.
Oh, Simonmakes a goodpoint.
I said K meansinthesensethat K meanswillfindtheclusterswithoutthelabels.
So I think I wasconflatingsomeconceptsthereandjustsortoflikethinkingaboutthevisualrelationshipbetweenthatexampleon k meansexample, butthatitactuallyisquite a differentthing.
Sothankyouforcorrectingmethere.
Umallright.
What's justhappened?
I don't know.
Sosomethinghasgonewronghere.
Thisexample s o.
I don't think I'm ableThioeffectivelydebugthisrightnow, ButthankyouforthesubmissionandDarSean, haveyouhappenedtobeinthechat?
What I wouldliketodois I wanttomakesomeadjustmentstothisticktacktoeexamplethat I won't includeinthefinaleditofthecodingchallenge.
But I willdowithyouhererightnow.
In a way, I wanttosimplifysomethingsaboutit, uh, justtomake.
I thinkthebut I reallywanttofocusonisthecoreminiMaxalgorithm.
And I don't wanttoadd a lotofcomplexityrelatedtothegamemechanicsthemselves.
So I'm goingtoassumethatthere's onlyevertwoplayersand I'm goingtosaythere's goingtobeanayeayeplayer, whichwillbetheexand a humanplayer, whichwillbein o umAndthen I amgoingto.
What I'm gonnadoislet's getridofthis, like, availablestufffor a secondonthis, likepicking a randomcurrentplayerthatcouldbeuseful.
Sowhat I'm gonnadois I'm gonnaadd a mousepressedfunction.
Andifthehumanplayeryouknow, ifthecurrentplayeris a human, let's getumah, let's gettheindexintotheboard.
Let's getwithMouse X dividedbywithmouse.
Whydividedbyheight, I'm gonnafloorthesesothattheirindexWhat I'm tryingtodorightnowisjustcreate a quickinteractionwhere, as I clickthemouse, ifwhere I click, themouseisanemptyspotontheboard.
Then I'm goingtofillitinwithmyhumanmarkingmyhumanmarking, whichisan O.
And, um, otherwise, ifthecumehumanplayeris a isitIfthecurrentplayeristheguy, actually, youknowwhat?
Soeverytime I clickthemouse, I'm tryingtothinkthroughthiswhat I'm actuallydoing.
I'llleavetheextrasomeextrastuffwrapsinhere.
Soifit's a validspot, thenthenextthing I wantisforthe a i tomakeitsturnSohumanmaketurn.
Thenifit's a validturn, thentheAI I shouldmakeitsturn.
Andrightnow, I justhaveitberandom, so I shouldn't havegottenridofthatavailablething, but I think I couldjustrewritethatbysaying I can, uh, justlookthroughallofthespots.
Um, thisissillybecause I alreadyused I and J, Okay.
A B C d e f g h i j k l I don't wanttouse l don't everuse l huh?
X goesfirst, thatis.
Thankyou, Simon.
I willcorrectthat, cause I willhavethe I gofirst.
Eventually.
Andi, I'm heretobreaktherules.
I'm gonnausean l.
Bygolly, hasmyindex.
Uh, andoh, thisissonow I'm writing a wholeextraalgorithmthat I don't wanttowrite.
Um, availablepush.
I is K.
Jayis l I want a littleobject.
No.
Well, no, no.
Let's justdothis.
Uh, okay.
L make a littleobject, andthen I wanttoThisissosillywhat I'm doing.
I shouldjustdoitinorder.
It's fine.
Then I'm goingtosaymoveequalsrandomavailableandthenboard.
Oh, what?
Onlyifit's available.
Ifboardkay l isblank.
Thisissosillythat I'm doing I didnotintendtowrite a wholenewalgorithmhereaslike a randomAye, aye, butit's what I'm doing.
Um, andthenmoveisrandom, andthenboardmovedot k.
Uhuh, Movedon.
L equals, um, equalstheAye.
Aye.
Andthenthecurrentplayeristhehuman.
I thinkthiscurrentplayerthingiscompletelyunnecessary, butthat's fine.
Andoncethehumansmade a validmove, thecurrentplayeristtheeeAy, ay.
Andlet's seeifthisdoeswhat I wanttodokWhatplayersisnotdefinedSketchedoutJs 109 Ifspotequalswhat I sayhumanwasOh, eventhough I'm doingitwrongAccordingtoSimonand A I is x availableisontofindsketch 49 because I gotridofthatconceptandthenaddeditbackinagain.
I dowonderiftickedIf I dothisparticularcodingchallengewithMiniMax, ifthatwilllaythegroundworkforfuturevideosas I lookatMaur, um, learningstylesandcuelearningbeoneofthemforreinforcementLearning.
Okay.
Couldyoucheck?
Yes.
I certainlycouldcheckthewindconditionafteryou.
I don't feellikecorrectingthatrightnow.
That's justgonnabe a bug, that I'm gonnaleaveinthere.
AndBut I amnowgoingto, um, getstarted, and I'm goingtoneedheavyuseofthewhiteboard.
Soletmejusttestintheyear.
I also I think, diagrammingtheminiMaxalgorithm.
I'm goingtowanttousemultiplecolors, so I havenotcoatedthisbefore.
But I diddosomereadingonitandthinkingaboutit, and I drewsomediagramson a whiteboardinmyoffice.
I I'm somewhatpreparedforthis, which I'm sureitwillallgohorriblywrong.
So I'm yet I'vekindofthisthinghashappenedwheresometimes I havetheserecordingsessions, wherearewhicharememberonlylivestreamswhere I reallyallowmyselftostartoverlike 15 times.
Andpartofmyreasonfordoingthatwassothat I wouldstopdoingthatsomuchduringwhat's morepubliclifestream.
Unfortunately, I I I'm notabletoswitchthatmuscleoff.
Andwhat I reallywanttoattempttonotstopcertainstopsomanytimes, butjustgowithit.
And, um, Macha, coatingtraineditorextraordinaire, willhopefullymakethisallwonderfulandeasytowatchinabout 30 to 45 minutes, which I thinkit's mytargetforthisendingup.
Um, usualcoatingjustwantsmetoseetheircomment.
I seeyou.
I seeyou.
Helloandwelcometocodingchallenge.
Ticktacktoetheminimaxalgorithm.
SoyoumightremembermefrommyCockneychallengeNumber 1 49 tictacktoewhere I made a verybasicsomewhat.
What's theword?
I'm lookingforMessiandspaghetti.
Likewhere I made a verysortoflike a bigbestoutofticktacktoe.
But I need a workingversionofthegame, which I haverunninghereinthebrowser.
Now, I madesomeveryslightadjustmentstowhere I leftoffinthatlastvideo.
I madesomeadjustmentstoitsothat I couldas a humanbeing, playedthegame.
Sorightnow I'm gonnaplaytherandomcomputerpicker.
I'm gonnagohere, andthen I'm gonnablock X gohere I winwins.
Sowhat I havetheadjustmentthat I madeisthat I added a mousepressedfunctionwhere I findwheredid I click?
And I putmyhuman, uh, variable, whichistheletter o ontotheboard.
Andthen I callnextturnwherenextturnpicks a randomspotintheboardandmakesthatthe A I spotorexcessspot.
SothewholepointofthisvideoisformetoimplementsomethingcalledMiniMax, whichisanalgorithm, a searchalgorithm, ifyouwill, tofindtheoptimalnextmoveforthe A.
I mean, I couldfinditformyself, andthen I couldimplementit.
Buttheideais, I wantthisplayer, thecomputerplayertobeatmeatthegameoratleastTytoplay a perfectgame.
Maksimprobablyjustmemorize a fewkeyprinciplesofhowtoplay.
But I thinkit's a gooddemonstrationoftheMiniMaxalgorithm, andif I couldgetitworking, which I'm reallyopenagain, thenattheendofthisvideo, I'm goingtodiscusshowyoumighttakethatintoMaurcomplexscenarios.
Evensomethinglikechesspotentiallyis a gamethatyoucouldusethemoneyMaxalgorithmwithOkay, YouTubereminderfail.
What's that?
I don't knowwhatthatmeans.
Probablysomethingthat I did.
Okay.
Umoh, that's justTMCjoiningifthereminderProbably.
Allright, Sowegohere, gohere.
Allright.
Um, Matt, youmaybewecan, umwecanreplacetheselaterwithclips, but I'm justgoingtoNo, thisisgeeksforgeeksistheone.
Isthis a reputablepsychthat I shouldfeelhappily?
Um, youstop?
I'm notinterested.
Okay, uh, wegohearone.
Therewego.
Okay.
No, goaway.
Addstop.
Goaway.
Allyouadsyou'renotpayingme.
Youneedtoshowuponmylifestream, okay?
Actually, Lounodeistechnicallynotoftoday, but a sponsor.
But I'm alsogonnatakeabout a portionofthisvideototrytoexplainthealgorithminmyownwordsanddiagramitout, whichhopefullywillhelpmefigureoutwhatcode I needtowrite.
I don't know.
So I think I wanttotrytodothistwiceoncewithjust a verygeneralscenario.
And I'm goingtosaythatthey'regonnadrawwhatiswrongwiththismarker?
I hadsuch a goodonebefore.
I thoughtthatwassogood.
Realbetter.
Allright.
Um, am I doinghere?
MiniMaxalgorithmistypicallyexpressedorvisualizedas a treesowecanthinkoftherootofthetreeasthecurrentstateofthegate.
Oh, youcan't seethat, canyou?
I usuallyputtheselittlethings.
There's a littlemagnettotellmewherethetopoftheboardis, buttheywere a littlebittoohighofthecameraposition.
Oh, isittillthankyoufortellingmethatit's tilted.
Um, letmetrytofixthat.
I thoughtmaybeitwouldn't benoticeable.
Fortunately, I dohave a level.
I needtotightenthiscamera.
Let's see.
Howaboutit?
ISS?
Notasbadasyouwouldthink.
Oh, it's bad.
It's wayoff.
Okay, that's better.
Looseistheproblemtotightenit, but I think I thinkthat's better.
ButDuttonnotonlyworkswith a gameliketictacktoethatyou'llsee, it's simpleenoughwecanactuallyhavethistreeplayoutallthepossiblescenariosuntiloneoftheplayerswinsorthere's a tie.
Inotherscenarios, youhavetojustusesomekindofheuristictomake a guessastolikeweatherwon't know.
Sointhecaseofticktacktoe, Sointhecaseofticktacktoe, it's a simpleenoughgamewhere, atanygivenpoint, wecouldactuallycomputational e playouteverypossiblescenariountiloneplayerwinsorthere's a tie.