Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement stratified k-fold cross-validation #151

Open
ibnesayeed opened this issue Feb 15, 2017 · 2 comments
Open

Implement stratified k-fold cross-validation #151

ibnesayeed opened this issue Feb 15, 2017 · 2 comments

Comments

@ibnesayeed
Copy link
Contributor

Current k-fold cross-validation assumes that the supplied sample data is uniformly randomized, hence, performs simple slicing of the array for individual folds. We should partition the data in a way that the proportion of various classes are maintained in each fold. This can be the default or the only option or partition or alternatively an optional boolean parameter can be provided for stratification.

@Ch4s3
Copy link
Member

Ch4s3 commented Feb 22, 2017

I'm open to this, but wouldn't know how to do it.

@ibnesayeed
Copy link
Contributor Author

To enforce this, we will have to first prepare buckets of each class from the supplied sample set and then partition each subset into k equal parts. Finally, pick one chunk from each subset to make data for each of the k sets. It is not difficult to do. I can take care of it when I get a chance to play with the code again. However, for now we are shuffling the sample data before splitting, which would theoretically have the similar effect, except not very precise, depending on the randomness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants