SGD gradient calculation in Chapter 1,2,3 #1034
Unanswered
surajbhv7l
asked this question in
Q&A
Replies: 1 comment
-
If u don't set a batch size, it acts as Batch Gradient Descent (uses the entire dataset). Since u havent set batch_size in the code snippet, yes SGD acts as Batch Gradient Descent |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
here is the code Snippet:
#setting the optimiser SGD
loss_fn = nn.CrossEntropyLoss()
optimizer = torch.optim.SGD(model_4.parameters(),
lr=0.1) # exercise: try changing the learning rate here and seeing what happens to the model's performance
#using SGD on full training data:
loss = loss_fn(y_logits, y_blob_train)
acc = accuracy_fn(y_true=y_blob_train,
y_pred=y_pred)
My question is: Isn't the SGD here is acting as batch Gradient Descent as we are calculating gradient on full training data?
Beta Was this translation helpful? Give feedback.
All reactions