Current location: Homepage > cs > Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep51

Artificial Intelligence Full Course 2024 _ AI Tutorial For Beginners _ AI Full Course_ Intellipaat - Ep51

2025-07-11 13:42:30 [java] Source: MetaScripta
I would havepassed the entire Epoch and inspiring female scientiststhen I wouldhave called the gradient descent myaverage error is being calculated now ifyou see average error is somewhere inbetween right but if instead of thislet's say I had given a bad size or I Ihad calculated gradient descent aftereach and every row right if you see thefluctuations in the error in that casewill be very high right I will startwith 25 my error will go to 9 right thenmy error will go back to 100 whereas ifI am only sticking with average error myerror is uh coming out to be somewhereover here right44 and when we are applying gradientdescent what is it that we want to seewe want to see more fluctuations inerror is that correct because the morefluctuations we are going to see in theerror the more we will be able to findout what the minimum error is coming outto be and if the minimum error is comingout to be nine I would want my model togo ahead and Achieve that for each andevery datapoint does that makesense right so in a way these batchsizes the dividing your data into batchright this will actually give morefluctuations to the error and the morenumber of fluctuations in the error thatwe are having it means that there is ahigher possibility of us finding out theminimum error value instead of if wewould have passed the entire data andthen we would have calculated thegradient descent in that case in thatcase as well it's not that I'm notsaying that you will not be able to findthe minimum error but that process willbe more long it will be more timeconsuming whereas if you are calculatingyour gradient descent time and againafter batches of data because each andevery batch might be different yourerror fluctuations will be very highwhen your error fluctuations will behigh you will be able to find out whatthe minimum error is coming out to beright so hence you will be able to trackthe error curve in a much more efficientmanner right so this all of these valuesalso have a impact your bat size alsohas an impact on the accuracy of themodel because a bat your bat sizedividing your data into batches willactually give more fluctuation to theerror that can help you in finding outthe minimum value mik in thisexample see every batch is going in asequence right so if you're if let's sayfor the first B the weights that wereinitialized were zero for the secondbatch whatever error we are getting fromthat batch right the weights will beadjusted right now for the second batchmaybe the weights become values whichare 0.1 for some 0.2 for others minus0.1 for some others right then once whenthis batch has pass through once whenthe error has been calculated maybe theerror goes down now slightly then onceagain the weights will be calculatedright so all of these things arehappening in a sequencea gradient desentI've been explaining from 3 days onwardsright I will not be explaining each andeverything what are your doubts you canask your doubts I can clarify those howmany how incre ining bat size willreduce the error I'm not saying that byinre increasing the bat size the errorwill reduce right I'm saying that if youdivide your data into batches your dataor your error is going to see morefluctuations right if you don't divideit into batches you are getting theaverage error right you calculate theaverage error and if you're calculatingthe average let's say for a, data pointseven if let's say the error would havereduced for a couple of rows the overallerror is not going to be impacted thatmuch right but if you divide your datainto batches the fluctuation in theerror will be higher uh batch rightafter every batch is passed through themodel gradient descent is applied soover here there are the bath size iswhat the bath size isth000 and I have 50,000 rows in total so50,000 divided by 1,000 will give youhow much 500 so 500 times gradientdescent will be applied in thisdata whatever your bat size is afterthose many rows have been passed to yourmodel your gradient descent iscalculated right okay now the varianceof gradient descent so now if you seegradient descent as well uh it has manyvariants uh badge gradient stochasticgradient and mini badge gradient descentright so let's try to see what do wemean by these three variants of gradientdescent right right now we'll see thiswith an example uh let's assume we havesix images in the data right now whatbatch gradient descent does is that ittakes the entire data set at a time sothis is just like uh what we weretalking about if you don't divide yourdata into batches if you pass the entireEpoch to the model and then youcalculate the gradient this is somethingwhich is known as badge gradient descentright so back propagates the loss forall the 10 images not 10 six images at atime right so in batch gradient descentyou are not dividing the data intobatches opposite contrary to the nameyou're passing the entire data as asingle batchright stochastic gradient descentis exactly opposite of badge gradientdescent in badge gradient descent wewere passing the all the rows togetherand then we were calculating the uherrors over here what we are doing isthat after each and every row of datahas been passed right we are calculatingyour error and then we are applyinggradient descent right so if you seeyour stochastic gradient descent isnothing but yourgradient or your weight subd ishappening after every single row of datais being passed to the model right soyou can see that the complexity or ifyou have a th rows in your data then athousand times your gradient descentwill be applied in one Epoch if you give10 epochs then th000 into 10 10,000times your weight subd is going tohappen right somewhere in the middle ofthese two we have mini badge gradientdescent that is what we have discussedjust now right if I divide my data intobatches if I have a thousand rows Idivide these thousand rows into 10batches of 100 rows each right now thisif you see will take in the best

(Editor: code)

Recommended articles
Hot reading