@@ -215,6 +215,7 @@ def fit_iter(self, X, y,
215215 EX_list : typing .Union [list , tuple ] = None ,
216216 valid_size : float = .2 ,
217217 n_folds : int = None ,
218+ kfolds_group : typing .Union [list , np .ndarray ] = None ,
218219 cv_shuffle : bool = False ,
219220 warm_start : bool = False ,
220221 random_state : np .random .Generator = np .random .default_rng (),
@@ -240,7 +241,13 @@ def fit_iter(self, X, y,
240241 n_folds: int, default is None
241242 When n_folds is not None, use K-fold cross-validation when
242243 n_folds > 2. Or, use leave-one-out cross-validation when
243- n_folds = -1.
244+ n_folds = -1. For Group K-fold cross-validation, functions as
245+ `n_splits`.
246+
247+ kfolds_group: list or ndarray, default is None
248+ When kfolds_group is not None, use Group K-fold cross-validation
249+ with the specified groups. The length of kfolds_group must be
250+ equal to the number of samples in X.
244251
245252 cv_shuffle: bool, default is False
246253 Whether to perform sample shuffling before splitting the
@@ -277,6 +284,7 @@ def fit_iter(self, X, y,
277284 EX_list = EX_list ,
278285 valid_size = valid_size ,
279286 n_folds = n_folds ,
287+ kfolds_group = kfolds_group ,
280288 shuffle = cv_shuffle ,
281289 random_state = random_state ,
282290 use_partial_fit = self .use_partial_fit ,
@@ -398,6 +406,7 @@ def fit(self, X, y,
398406 EX_list : typing .Union [list , tuple ] = None ,
399407 valid_size : float = .2 ,
400408 n_folds : int = None ,
409+ kfolds_group : typing .Union [list , np .ndarray ] = None ,
401410 cv_shuffle : bool = False ,
402411 warm_start : bool = False ,
403412 random_state : np .random .Generator = np .random .default_rng ()
@@ -424,7 +433,13 @@ def fit(self, X, y,
424433 n_folds: int, default is None
425434 When n_folds is not None, use K-fold cross-validation when
426435 n_folds > 2. Or, use leave-one-out cross-validation when
427- n_folds = -1.
436+ n_folds = -1. For Group K-fold cross-validation, functions as
437+ `n_splits`.
438+
439+ kfolds_group: list or ndarray, default is None
440+ When kfolds_group is not None, use Group K-fold cross-validation
441+ with the specified groups. The length of group_kfolds must be
442+ equal to the number of samples in X.
428443
429444 cv_shuffle: bool, default is False
430445 Whether to perform sample shuffling before splitting the
@@ -450,6 +465,7 @@ def fit(self, X, y,
450465 EX_list = EX_list ,
451466 valid_size = valid_size ,
452467 n_folds = n_folds ,
468+ kfolds_group = kfolds_group ,
453469 cv_shuffle = cv_shuffle ,
454470 warm_start = warm_start ,
455471 random_state = random_state )
0 commit comments