shankarpandala / lazypredict

Lazy Predict help build a lot of basic models without much code and helps understand which models works better without any parameter tuning
MIT License
3.03k stars 345 forks source link

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

Open Rishabvanigotha123 opened 1 year ago

Rishabvanigotha123 commented 1 year ago

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 commented 1 year ago

Have you managed to fix this?

surzua commented 1 year ago

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))]