SequentialFeatureSelector内でGroupKFoldを行う
パラメータの"cv"には、list()化したスプリットを入れましょう。
"An iterable yielding (train, test) splits as arrays of indices."
例:
from sklearn.model_selection import GroupKFold
gkf = GroupKFold(n_splits=3)
gkf_split = list(gkf.split(X, y, groups=groups))
selector = SequentialFeatureSelector(model, n_features_to_select=nb_feat, direction=direction, scoring="r2", cv=gkf_split)
selector.fit(X, y)
参考
sklearn.feature_selection.SequentialFeatureSelectorの公式は↓
https://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.SequentialFeatureSelector.html#sklearn.feature_selection.SequentialFeatureSelector.set_params