It may sounds like a silly question but let's take the RidgeCV model from sklearn.linear_model. This one has the parameter "cv".
cv : int, cross-validation generator or an iterable, optional
Determines the cross-validation splitting strategy. Possible inputs for cv are:
None, to use the efficient Leave-One-Out cross-validation (also known as Generalized Cross-Validation).
integer, to specify the number of folds.
- CV splitter,
- An iterable yielding (train, test) splits as arrays of indices.
For integer/None inputs, if y is binary or multiclass, sklearn.model_selection.StratifiedKFold is used, else, sklearn.model_selection.KFold is used.
My question is the following: Why do we have to call KFold() when the parameter 'cv' is already performing a k-fold ? (if integer specified)
To make it clearer, why do we have this:
kfolds = KFold(n_splits=10, shuffle=True, random_state=42) ridge = RidgeCV(alphas=alphas_alt, cv=kfolds)
And not only this ?
ridge = RidgeCV(alphas=alphas_alt, cv=10)