when fold is not an integer, how does refit work?
Hey team, In RandomisedSearchCV or SuccessiveHalving, we can pass indexes in the fold parameter, if we want to test the hyperparameters on specific folds. Say I have a dataset of 12 rows, indexes 1 to 12, and I pass as fold to the randomized search or SH the following folds: [1,2] [9, 10, 11, 12] [3, 10] [5,6,7,8] [7, 11] [1,2,3,4] It will use [1,2], [3,10] and [7,11] to train the model, and the second part with the 4 rows as the test set. My question is, when refit=True, what does it use to train the final model? X? the sum of the training folds? the sum of the test folds? something else? It's a follow up question to this reply on SO: [https://stackoverflow.com/questions/79748461/how-to-pass-pre-computed-folds-to-successivehalving-in-sklearn](https://stackoverflow.com/questions/79748461/how-to-pass-pre-computed-folds-to-successivehalving-in-sklearn?noredirect=1#comment140703041_79748461) Thanks a lot! Best wishes, Soledad Galli https://www.trainindata.com/
My question is, when refit=True, what does it use to train the final model? X?
As per the documentation says: "Refit an estimator using the best found parameters on the whole dataset." So it refit on the entire `X` using the best parameters found during the cross-validation procedure with respect to a given metric. On Tue, 16 Sept 2025 at 15:27, Sole Galli via scikit-learn < scikit-learn@python.org> wrote:
Hey team,
In RandomisedSearchCV or SuccessiveHalving, we can pass indexes in the fold parameter, if we want to test the hyperparameters on specific folds.
Say I have a dataset of 12 rows, indexes 1 to 12, and I pass as fold to the randomized search or SH the following folds:
[1,2] [9, 10, 11, 12] [3, 10] [5,6,7,8] [7, 11] [1,2,3,4]
It will use [1,2], [3,10] and [7,11] to train the model, and the second part with the 4 rows as the test set.
My question is, when refit=True, what does it use to train the final model? X? the sum of the training folds? the sum of the test folds? something else?
It's a follow up question to this reply on SO: https://stackoverflow.com/questions/79748461/how-to-pass-pre-computed-folds-... <https://stackoverflow.com/questions/79748461/how-to-pass-pre-computed-folds-...>
Thanks a lot!
Best wishes,
Soledad Galli https://www.trainindata.com/ _______________________________________________ scikit-learn mailing list -- scikit-learn@python.org To unsubscribe send an email to scikit-learn-leave@python.org https://mail.python.org/mailman3//lists/scikit-learn.python.org Member address: g.lemaitre58@gmail.com
-- Guillaume Lemaitre
participants (2)
-
Guillaume Lemaître -
Sole Galli