# Should I report loss on the last batch or the entire training dataset?

In the training loop below, you can see that train_loss represents the loss on the most recent batch.

Whereas the eval_loss is computed on the entire training dataset.

When I print it out, should I be recalculating the train_loss against the entire training split instead of the last batch?

for epoch in range(epochs):
# Loop over batches.
for i, batch in enumerate(samples_train['features']):

train_preds = model(samples_train['features'][i])
train_loss = loss_fn(train_preds, samples_train['labels'][i])

train_loss.backward()
optimizer.step()

# Only the training data is batched.
eval_preds = model(samples_evaluate['features'])
eval_loss = loss_fn(eval_preds, samples_evaluate['labels'])

print(f"Epoch: {epoch}, Train_Loss: {float(train_loss)},  Eval_Loss: {float(eval_loss)}")

• hmm now i am thinking about undersized batches and leaning toward the whole split Apr 6, 2021 at 23:28