Skip to content

n_splits=5 cannot be greater than the number of members in each class. #54

Description

@sherlyn99

I might have missed this in the documentation - what are the minimum number of samples for control and treatment required for the analysis?

Follow up: error disappeared after including more samples. Would be helpful to add the minimum number of samples required in the documentation

Traceback (most recent call last):
  File "/Users/y1weng/Downloads/20231129_qadabra_gutb/mi04t1_qadabra_out/.snakemake/scripts/tmp9w0fsvnp.logistic_regression.py", line 54, in <module>
    folds = [(train, test) for train, test in cv.split(X, y)]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/y1weng/Downloads/20231129_qadabra_gutb/mi04t1_qadabra_out/.snakemake/scripts/tmp9w0fsvnp.logistic_regression.py", line 54, in <listcomp>
    folds = [(train, test) for train, test in cv.split(X, y)]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/y1weng/Downloads/20231129_qadabra_gutb/mi04t1_qadabra_out/.snakemake/conda/ae102f57fe1fb6ba91271bbd0ace3284_/lib/python3.11/site-packages/sklearn/model_selection/_split.py", line 1527, in split
    for train_index, test_index in cv.split(X, y, groups):
  File "/Users/y1weng/Downloads/20231129_qadabra_gutb/mi04t1_qadabra_out/.snakemake/conda/ae102f57fe1fb6ba91271bbd0ace3284_/lib/python3.11/site-packages/sklearn/model_selection/_split.py", line 377, in split
    for train, test in super().split(X, y, groups):
  File "/Users/y1weng/Downloads/20231129_qadabra_gutb/mi04t1_qadabra_out/.snakemake/conda/ae102f57fe1fb6ba91271bbd0ace3284_/lib/python3.11/site-packages/sklearn/model_selection/_split.py", line 108, in split
    for test_index in self._iter_test_masks(X, y, groups):
  File "/Users/y1weng/Downloads/20231129_qadabra_gutb/mi04t1_qadabra_out/.snakemake/conda/ae102f57fe1fb6ba91271bbd0ace3284_/lib/python3.11/site-packages/sklearn/model_selection/_split.py", line 770, in _iter_test_masks
    test_folds = self._make_test_folds(X, y)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/y1weng/Downloads/20231129_qadabra_gutb/mi04t1_qadabra_out/.snakemake/conda/ae102f57fe1fb6ba91271bbd0ace3284_/lib/python3.11/site-packages/sklearn/model_selection/_split.py", line 732, in _make_test_folds
    raise ValueError(
ValueError: n_splits=5 cannot be greater than the number of members in each class.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions