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
2.86k stars 329 forks source link

Solved Issue related to the argument 'classifiers' in LazyClassifier class #333

Closed Arritmic closed 3 years ago

Arritmic commented 3 years ago

Bug related to the configuration of the class LazyClassifier:

 # Lazy Classifier configuration with SPECIFIC classifier algorithms
 clf = LazyClassifier(verbose=0, ignore_warnings=True, custom_metric=None, classifiers=[RandomForestClassifier(), LinearDiscriminantAnalysis(), ExtraTreesClassifier(), QuadraticDiscriminantAnalysis(), SGDClassifier()])
 # Training and testing evaluation
 models, predictions = clf.fit(X_train, X_test, y_train, y_test)
 print(models)

I have added a test application in such a way that it is possible to reproduce the bug:

(LazyPredictor) arritmic@mycomputer ~/Projects/Github/lazypredict/app (dev) $ python predictor_selection_test.py 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 218453.33it/s] Empty DataFrame Columns: [Accuracy, Balanced Accuracy, ROC AUC, F1 Score, Time Taken] Index: []

After solving the issue in Supervised.py:

(LazyPredictor) arritmic@mycomputer ~/Projects/Github/lazypredict/app (dev) $ python predictor_selection_test.py

100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 18.71it/s] Accuracy Balanced Accuracy ROC AUC F1 Score Time Taken Model
SGDClassifier 0.96 0.97 0.97 0.97 0.01 RandomForestClassifier 0.96 0.96 0.96 0.96 0.14 ExtraTreesClassifier 0.96 0.96 0.96 0.96 0.10 QuadraticDiscriminantAnalysis 0.96 0.96 0.96 0.96 0.01 LinearDiscriminantAnalysis 0.96 0.95 0.95 0.96 0.01

shankarpandala commented 3 years ago

@Arritmic Thankyou so much for your contribution. Writing test cases is one of the skills I lack in. This test case and bug fix helps a lot. Appreciate your time and effort

Arritmic commented 3 years ago

@shankarpandala You're welcome. Then, I will try to help in the near future with more proper tests.

And thanks to you for this amazing tool. :) Really useful for prototyping.