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

ValueError: too many values to unpack (expected 2) #431

Open
Rishabvanigotha123 opened this issue May 17, 2023 · 2 comments
Open

ValueError: too many values to unpack (expected 2) #431

Rishabvanigotha123 opened this issue May 17, 2023 · 2 comments

Comments

@Rishabvanigotha123
Copy link

i tried to specify few classifiers names in LazyClassfier functionbut it ended up with the following error
ValueError: too many values to unpack (expected 2)

'str' object has no attribute '__name__'
Invalid Classifier(s)
  0%|          | 0/4 [00:00<?, ?it/s]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[27], line 1
----> 1 models,predictions = clf.fit(X_train, X_test, y_train, y_test)

File [~/dataneuron/lazypredev/lib/python3.8/site-packages/lazypredict/Supervised.py:288](https://vscode-remote+wsl-002bubuntu-002d20-002e04.vscode-resource.vscode-cdn.net/home/rishab/dataneuron/~/dataneuron/lazypredev/lib/python3.8/site-packages/lazypredict/Supervised.py:288), in LazyClassifier.fit(self, X_train, X_test, y_train, y_test)
    285         print(exception)
    286         print("Invalid Classifier(s)")
--> 288 for name, model in tqdm(self.classifiers):
    289     start = time.time()
    290     try:

ValueError: too many values to unpack (expected 2)

i gave classifiers = ['LogisticRegression','RandomForest','SVC'] as the input in LazyClassfier function

@Sjb4243
Copy link

Sjb4243 commented Jun 29, 2023

Have you managed to fix this?

@surzua
Copy link

surzua commented Jul 31, 2023

This is the correct way to set a list of classifiers, is not a list of strings:

from sklearn.utils import all_estimators
from sklearn.base import ClassifierMixin

removed_classifiers = [
"ClassifierChain",
"ComplementNB",
"GradientBoostingClassifier",
"GaussianProcessClassifier",
"HistGradientBoostingClassifier",
"MLPClassifier",
"LogisticRegressionCV",
"MultiOutputClassifier",
"MultinomialNB",
"OneVsOneClassifier",
"OneVsRestClassifier",
"OutputCodeClassifier",
"RadiusNeighborsClassifier",
"VotingClassifier",
'SVC','LabelPropagation','LabelSpreading','NuSV','CategoricalNB ']
classifiers_list = [est for est in all_estimators() if (issubclass(est[1], ClassifierMixin) and (est[0] not in removed_classifiers))]

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

3 participants