I think I am starting to feel confident about gradient descent and the math behind it. I know I'll have to come back again but for now the intuition seems solid. Thanks again! :))
@ashishprasadverma9428
2 жыл бұрын
I have only one word to say ,Thankyou sir for this amazing content
@sheetalkumari9746
2 жыл бұрын
your content seem to be the best out of i've seen so far, its great!!!!
@AnjaliSharma-lq8ut
6 ай бұрын
Sir, you are too good. The hardwork is so apparent and thankyou so much for your teaching.
@sakalagamingyt3563
3 ай бұрын
Very well understood!
@rb4754
3 ай бұрын
You explained GD outstandingly....
@vivaanyadav1st
9 ай бұрын
intercept_def = -2 * np.mean(y_train[idx] - y_hat) I think there is an error it should be intercept_def = -2 * (y_train[idx] - y_hat) By the way video is just looking like a wow ❤☺
@bitanbarman7930
7 ай бұрын
Why does intercept_der = -2 * (y_train - y_hat) and not intercept_der = -2 * np.mean(y_train - y_hat). If you do not put "np.mean" in intercept_der, then it is a vector of size (10, 1), then self.intercept = self.intercept - (self.lr * intercept_der) is a (10,1) vector, but in reality self.intercept is a scalar or a single value (it is assumed self.intercept = 0 at the begining of the function loop). I think np.mean is necessary otherwise the calculation will go haywire.
@LetsClarifyIt
Күн бұрын
@@bitanbarman7930 correct mean is needed for intercept but for coeff we need to pass it inner calculation otherwise here also it covers no scaler of 1,1 dim
@JACKSPARROW-ch7jl
Жыл бұрын
Thank you Nitish🎉
@deepkothari7211
6 ай бұрын
hello sir , Can you Try to make a Video on Stock Market Prediction Using LSTM (knowledge purpose only)
@ParthivShah
5 ай бұрын
Thank You Sir.
@robinarora3999
Жыл бұрын
in coef_der we have to divide by self.batch_size like in the previous we divide by X_train.shape[0] for the mean
@user-it5dt5ei4y
Ай бұрын
you are saying write .i also notice that .but when i divide by self.batch_size the r2_score comes to be very low .i don't know it is happening?
@Noob31219
2 жыл бұрын
Extra ordinary teaching 👏
@faizanadil9093
3 ай бұрын
iam fro Gilgit baltistan (pakistan), Sir ma sirf kahungha kia baat hay 😊
@ekemm
2 ай бұрын
the reason our SGDregressor was working better in prev video b/c we were using X_train.shape[1] as range for inner loop but think range should be the # of rows shape[0] or this code in Stochastic Gradient for i in range(self.epochs): # X_train.shape[1] is the # of features/cols : we do this # b/c we have to calculate for b0,b1,b2,b3.... for j in range(X_train.shape[1]): idx = np.random.randint(0,X_train.shape[0]) # we will extract idxth row # y hat is scalar now y_hat = np.dot(X_train[idx],self.coef_) + self.intercept_ intercept_derivative = -2 * (y_train[idx] - y_hat) self.intercept_ = self.intercept_ - (self.lr*intercept_derivative)
@vrushabhjain1542
2 жыл бұрын
please create tutorials on deep learning from scratch
@rsk_016
Жыл бұрын
Hello sir. Thank you for the video. Excellent teaching. Just had a small doubt. For Mini-batch GD, the coef_der = -2 * (value) according to your video. Shouldn't it be coef_der = -2/self.batch_size * (value) ? As far as I understand, n=1 in SGD and n = X_train.shape[1] in Batch. So, it should be n = self.batch_size in Mini-batch right?
@user-zc3pg2fj4o
4 ай бұрын
yes same doubt for me can u pls explain me now if u have understood it
@LetsClarifyIt
Күн бұрын
i felt very bad even when i had used sklearn LinerRegression model i was getting negative r2score on same dataset
@rrohit1713
6 ай бұрын
Hi may i know where can i get the files for the cost function visualization and other visualizations for batch, stochastic gradient descent
@dipanjanjayswal554
2 жыл бұрын
sir for the intercept_der & coef_der you took -2 but I believe now we've to divide -2 by batch size as the formula is -2/n... Please tell If I'm wrong. Thank You
@krishnakanthmacherla4431
2 жыл бұрын
I also have the same doubt
@krishnakanthmacherla4431
2 жыл бұрын
@Campus x , can you clear this ??
@abhishekkukreja6735
2 жыл бұрын
we will divide with the batch size only with coef_der and not with intercept_der because in intercept_der we can do the mean operation as we're getting the batch size accordingly below is the code def fit(self,X_train,y_train): # initialize the coefficients and intercepts self.intercept_ = 0 self.coef_ = np.ones(X_train.shape[1]) for i in range(self.epochs): for j in range(int(X_train.shape[0] / self.batch_size)): # Generating random numbers for the given batch size idx = random.sample(range(X_train.shape[0]), self.batch_size) y_hat = np.dot(X_train[idx] , self.coef_) + self.intercept_ intercept_der = (-2) * np.mean(y_train[idx]-y_hat) self.intercept_ = self.intercept_ - (self.lr*intercept_der) coef_der = (-2/self.batch_size) * np.dot((y_train[idx] - y_hat),X_train[idx]) self.coef_ = self.coef_ - (self.lr * coef_der) print(self.intercept_ , self.coef_)
@0xDhaval
6 ай бұрын
@@abhishekkukreja6735 I also think intercept_der should be divided by batch_size. But it is giving a very poor r2 score. Dont know why.
@kuldeeprajput395
2 жыл бұрын
outstanding content...
@utsavtank559
Жыл бұрын
Thank you for the video.
@jimmysandhu66
7 ай бұрын
Hi Nitin, First of all Thanks for the wonderful content you are giving to us. I have one doubt in this video. In the last part where you are showing code for mini batch gradient descent, in every batch all the rows are used in SGD one by one to make changes in the prediction, but ideally the change in the coefficients should be made once in every epoch i.e. for one batch. So i think it is not mini batch gradient descent. Please correct me if i am wrong.
@shahidulmorsalinjahin5277
3 ай бұрын
Yes! same concern!
@indrajitpatil7533
Ай бұрын
i think ,we sent batch(n number of row) to sgd regressor and behind the scene sgd regressor doing update for each row.am i right?
@LetsClarifyIt
Күн бұрын
batch is number of rows you consider calculating the loss, so here co-efficient will be update for batch, epochs is how many time you need to update co-efficient for all batches
@stevegabrial1106
3 жыл бұрын
Another great video, thx
@ekemm
2 ай бұрын
for this code in Stochastic Gradient for i in range(self.epochs): # X_train.shape[1] is the # of features/cols : we do this # b/c we have to calculate for b0,b1,b2,b3.... for j in range(X_train.shape[1]): idx = np.random.randint(0,X_train.shape[0]) # we will extract idxth row # y hat is scalar now y_hat = np.dot(X_train[idx],self.coef_) + self.intercept_ intercept_derivative = -2 * (y_train[idx] - y_hat) self.intercept_ = self.intercept_ - (self.lr*intercept_derivative) coef_derivative = -2 * np.dot((y_train[idx] - y_hat), X_train[idx]) self.coef_ = self.coef_ - (self.lr * coef_derivative) ------- we are doing # features/epoch updates b/c inner loop X_train[1] is the no of cols/features ? I am bit confused. Thanks : )
@LetsClarifyIt
Күн бұрын
x_train.shape[1] will give number of features(independent variables), where as x_train[idx] will be a row having values of all features at that idx i.e for example x_train[5]=[x_trian[5,0],x_train[5,1],xtrain[5,2]...xtrain[5,m]], here m is number of features
@heetbhatt4511
10 ай бұрын
Thank you
@Ishant875
7 ай бұрын
Why are we using random numbers, if we can use the whole data batch by batch contiguously?
@LetsClarifyIt
Күн бұрын
than it will be same as batch gradient descent na if your function is not convex than you will be less chance of reaching global minima
@namratajadhav7172
Жыл бұрын
the fit function is giving key error
@foottrick7710
3 жыл бұрын
Sir can I learn machine learning after m.sc math ?
Пікірлер: 44