tokebe / niclassify

A combined GUI toolkit for predictively classifying arthropod sequences as Native/Introduced
GNU General Public License v3.0
0 stars 0 forks source link

Program fails to check for minimum class samples #17

Closed tokebe closed 3 years ago

tokebe commented 3 years ago

Check for least populated class having minimum number of samples for successful training.

Exception in thread Thread-19:

Traceback (most recent call last):

  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 954, in _bootstrap_inner

    self.run()

  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 892, in run

    self._target(*self._args, **self._kwargs)

  File "/Users/jandersen/Downloads/niclassify-main2/niclassify/tkgui/clftool.py", line 1122, in _train_classifier

    self.sp.train_AC(features, metadata, status_cb)

  File "/Users/jandersen/Downloads/niclassify-main2/niclassify/core/StandardProgram.py", line 1270, in train_AC

    self.clf.train(

  File "/Users/jandersen/Downloads/niclassify-main2/niclassify/core/classifiers.py", line 331, in train

    x_train, x_test, y_train, y_test = self._get_test_train_splits(

  File "/Users/jandersen/Downloads/niclassify-main2/niclassify/core/classifiers.py", line 138, in _get_test_train_splits

    x_train, x_test, y_train, y_test = train_test_split(

  File "/Users/jandersen/Downloads/niclassify-main2/niclassifyenv/lib/python3.9/site-packages/scikit_learn-0.24.0rc1-py3.9-macosx-10.9-x86_64.egg/sklearn/model_selection/_split.py", line 2197, in train_test_split

    train, test = next(cv.split(X=arrays[0], y=stratify))

  File "/Users/jandersen/Downloads/niclassify-main2/niclassifyenv/lib/python3.9/site-packages/scikit_learn-0.24.0rc1-py3.9-macosx-10.9-x86_64.egg/sklearn/model_selection/_split.py", line 1387, in split

    for train, test in self._iter_indices(X, y, groups):

  File "/Users/jandersen/Downloads/niclassify-main2/niclassifyenv/lib/python3.9/site-packages/scikit_learn-0.24.0rc1-py3.9-macosx-10.9-x86_64.egg/sklearn/model_selection/_split.py", line 1715, in _iter_indices

    raise ValueError("The least populated class in y has only 1"

ValueError: The least populated class in y has only 1 member, which is too few. The minimum number of groups for any class cannot be less than 2.