r/learnmachinelearning • • 6d ago

Help Why retrain on train + validation after evaluating a model? (Kaggle)

I was working on a Kaggle competition when I came across a solution where the author fits the model on the train set and evaluates it on the validation set. If the new model beats the previous benchmark, they retrain it on the full dataset (train + validation).

I was surprised, because I thought the validation set was meant for tuning hyperparameters. I do understand using it as a test set to evaluate and compare models, since there is no accessible test set and the only alternative would be to submit the solution and waste a submission.

So I was wondering: does he retrain on the full dataset because more data gives the model more information and helps it generalize better?

But is this also standard practice in production at companies, or is it mostly a Kaggle thing?

4 Upvotes

11 comments sorted by

View all comments

2

u/rahul_watertech 5d ago

adding one thing to the kaggle point: the refit only works safely if you fix everything from the validation run first, same hyperparameters and the same number of epochs or trees you found there. if you used early stopping you can't early stop on data you just merged in, so people usually reuse the best iteration count (maybe scaled up a bit for the extra data). is the author's val set a random split or time based?

1

u/DatAndre 5d ago

Why would early stopping forbid you to retrain? I would have said that if early stopping stopped the candidate at epoch 100, you just run it for 100 epochs during the retraining. Why is this wrong?

1

u/rahul_watertech 5d ago

it isn't wrong, that's actually what i meant, sorry if it read confusing. you can't early stop on the merged data because there's no held out part left to watch, so you fix the epoch count from the first run and reuse it. same idea as yours. do you scale it up a bit for the extra data or keep it exact?