Checkoutthisvideowhereinjust a coupleofminutes, I'llgetyousetuptouseitwiththepiecharm I D ifyoulike, Mayandyouliketowrite a fewlinesofcodeat a timeandthenstepthroughthemtomakesurethattheybehaveproperly.
Butyou'restuck a littlebitwithdoingthatwithPythoninTensorflow.
Thenthisvideoisforyou.
Here I have a verysimplehelloworldtypeapplicationwhere I'm goingtotrain a modelandthenruninferenceonit.
Sohere I'm feedingthemodelwith a setofexesandwise, andthere's a relationshipbetween X and Y.
It's a linearrelationship, andifyouthinkaboutit, you'llseethatwhyequalstwo X minusone?
So, forexample, if X equals 42 x minusoneissavinwhen X equals 32 X minusoneisfive, etcetera, etcetera.
Sowithonlyjust a fewpointsofdata, I'm goingtotrain a modelandnotethat I'm nottellingittheformulaofjusttrainingitondataandthen I'lltrytounfairfromthat.
Whatthe Y valuesshouldbewhen X equals 10.
Nowweknowthatthat's 19 butwhatwillthemodelinfair?
Solet's take a lookatdebuggingit.
I'm goingtoset a breakpoint.
Andjustlike I wouldwithAndroidStudioofVisualstudio, I canrun a debug, the D buggerwilllaunch, andnowyoucansee I'm instepbystepdebugging.
Sohere I havemymodel, andif I clickStapptostepoverits I'vecreatedit, and I couldeventake a peekinsideofit.
Here I hadmylayer, andit's justonewithonenote.
Soit's notreally a network, butit's morelike a singleneuron.
Andnow I canstepoverthecompilationofthemodelandspecifyingthelossandoptimizerfunctionsformyexesandwise, youcanseethatthey'renumbpyreraise, sowhen I stepoverthem, I caninspectthoseitdirectlyinthe D bugger.
Sonowwhen I runmodeledoutfiton, I'm passingmyexesandwisein, I canseethatthecorrectdataisbeingpassedintothetrainingofthenetwork.
Soifsomethinggoeswrong, I knowit's notbecauseofthedata.
Sonowwhen I stepoverthatwecanseethetrainingtakesplace.
Now I have a trainedmodelso I cansteptothenextlineandstartlookingatpredictingvaluesbasedonthatmodel.
Solet's predictvaluesfor 10 11 12 and 13.
Andwhen I runmodelpredictonthesevaluesandprintedout, wecanseetheanswersintheconsole.
Theresultsareprettyclose.
For 10 I wouldhaveexpected 19 andfor 11 I wouldget 21.