Created
May 19, 2015 21:33
-
-
Save dengemann/873d6b782f7a4d5fca2b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Authors: Denis A. Engemann <[email protected]> | |
# | |
# License: simplified BSD 3 clause | |
from sklearn.cross_validation import StratifiedKFold | |
def repeated_folds(y, n_folds, n_repeats, seeds): | |
use_seeds = seeds[:n_repeats] | |
cv = [list( # resample | |
StratifiedKFold(y=y, n_folds=n_folds, shuffle=True, random_state=seed)) | |
for seed in use_seeds] | |
cv = sum(cv, list()) # concatenate | |
return cv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment