Giter Club home page Giter Club logo

lazypredict's Introduction

Lazy Predict

image Build Status Documentation Status Downloads CodeFactor

Lazy Predict helps build a lot of basic models without much code and helps understand which models works better without any parameter tuning.

Installation

To install Lazy Predict:

pip install lazypredict

Usage

To use Lazy Predict in a project:

import lazypredict

Classification

Example :

from lazypredict.Supervised import LazyClassifier
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split

data = load_breast_cancer()
X = data.data
y= data.target

X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=.5,random_state =123)

clf = LazyClassifier(verbose=0,ignore_warnings=True, custom_metric=None)
models,predictions = clf.fit(X_train, X_test, y_train, y_test)

print(models)


| Model                          |   Accuracy |   Balanced Accuracy |   ROC AUC |   F1 Score |   Time Taken |
|:-------------------------------|-----------:|--------------------:|----------:|-----------:|-------------:|
| LinearSVC                      |   0.989474 |            0.987544 |  0.987544 |   0.989462 |    0.0150008 |
| SGDClassifier                  |   0.989474 |            0.987544 |  0.987544 |   0.989462 |    0.0109992 |
| MLPClassifier                  |   0.985965 |            0.986904 |  0.986904 |   0.985994 |    0.426     |
| Perceptron                     |   0.985965 |            0.984797 |  0.984797 |   0.985965 |    0.0120046 |
| LogisticRegression             |   0.985965 |            0.98269  |  0.98269  |   0.985934 |    0.0200036 |
| LogisticRegressionCV           |   0.985965 |            0.98269  |  0.98269  |   0.985934 |    0.262997  |
| SVC                            |   0.982456 |            0.979942 |  0.979942 |   0.982437 |    0.0140011 |
| CalibratedClassifierCV         |   0.982456 |            0.975728 |  0.975728 |   0.982357 |    0.0350015 |
| PassiveAggressiveClassifier    |   0.975439 |            0.974448 |  0.974448 |   0.975464 |    0.0130005 |
| LabelPropagation               |   0.975439 |            0.974448 |  0.974448 |   0.975464 |    0.0429988 |
| LabelSpreading                 |   0.975439 |            0.974448 |  0.974448 |   0.975464 |    0.0310006 |
| RandomForestClassifier         |   0.97193  |            0.969594 |  0.969594 |   0.97193  |    0.033     |
| GradientBoostingClassifier     |   0.97193  |            0.967486 |  0.967486 |   0.971869 |    0.166998  |
| QuadraticDiscriminantAnalysis  |   0.964912 |            0.966206 |  0.966206 |   0.965052 |    0.0119994 |
| HistGradientBoostingClassifier |   0.968421 |            0.964739 |  0.964739 |   0.968387 |    0.682003  |
| RidgeClassifierCV              |   0.97193  |            0.963272 |  0.963272 |   0.971736 |    0.0130029 |
| RidgeClassifier                |   0.968421 |            0.960525 |  0.960525 |   0.968242 |    0.0119977 |
| AdaBoostClassifier             |   0.961404 |            0.959245 |  0.959245 |   0.961444 |    0.204998  |
| ExtraTreesClassifier           |   0.961404 |            0.957138 |  0.957138 |   0.961362 |    0.0270066 |
| KNeighborsClassifier           |   0.961404 |            0.95503  |  0.95503  |   0.961276 |    0.0560005 |
| BaggingClassifier              |   0.947368 |            0.954577 |  0.954577 |   0.947882 |    0.0559971 |
| BernoulliNB                    |   0.950877 |            0.951003 |  0.951003 |   0.951072 |    0.0169988 |
| LinearDiscriminantAnalysis     |   0.961404 |            0.950816 |  0.950816 |   0.961089 |    0.0199995 |
| GaussianNB                     |   0.954386 |            0.949536 |  0.949536 |   0.954337 |    0.0139935 |
| NuSVC                          |   0.954386 |            0.943215 |  0.943215 |   0.954014 |    0.019989  |
| DecisionTreeClassifier         |   0.936842 |            0.933693 |  0.933693 |   0.936971 |    0.0170023 |
| NearestCentroid                |   0.947368 |            0.933506 |  0.933506 |   0.946801 |    0.0160074 |
| ExtraTreeClassifier            |   0.922807 |            0.912168 |  0.912168 |   0.922462 |    0.0109999 |
| CheckingClassifier             |   0.361404 |            0.5      |  0.5      |   0.191879 |    0.0170043 |
| DummyClassifier                |   0.512281 |            0.489598 |  0.489598 |   0.518924 |    0.0119965 |

Regression

Example :

from lazypredict.Supervised import LazyRegressor
from sklearn import datasets
from sklearn.utils import shuffle
import numpy as np

boston = datasets.load_boston()
X, y = shuffle(boston.data, boston.target, random_state=13)
X = X.astype(np.float32)

offset = int(X.shape[0] * 0.9)

X_train, y_train = X[:offset], y[:offset]
X_test, y_test = X[offset:], y[offset:]

reg = LazyRegressor(verbose=0, ignore_warnings=False, custom_metric=None)
models, predictions = reg.fit(X_train, X_test, y_train, y_test)

print(models)


| Model                         | Adjusted R-Squared | R-Squared |  RMSE | Time Taken |
|:------------------------------|-------------------:|----------:|------:|-----------:|
| SVR                           |               0.83 |      0.88 |  2.62 |       0.01 |
| BaggingRegressor              |               0.83 |      0.88 |  2.63 |       0.03 |
| NuSVR                         |               0.82 |      0.86 |  2.76 |       0.03 |
| RandomForestRegressor         |               0.81 |      0.86 |  2.78 |       0.21 |
| XGBRegressor                  |               0.81 |      0.86 |  2.79 |       0.06 |
| GradientBoostingRegressor     |               0.81 |      0.86 |  2.84 |       0.11 |
| ExtraTreesRegressor           |               0.79 |      0.84 |  2.98 |       0.12 |
| AdaBoostRegressor             |               0.78 |      0.83 |  3.04 |       0.07 |
| HistGradientBoostingRegressor |               0.77 |      0.83 |  3.06 |       0.17 |
| PoissonRegressor              |               0.77 |      0.83 |  3.11 |       0.01 |
| LGBMRegressor                 |               0.77 |      0.83 |  3.11 |       0.07 |
| KNeighborsRegressor           |               0.77 |      0.83 |  3.12 |       0.01 |
| DecisionTreeRegressor         |               0.65 |      0.74 |  3.79 |       0.01 |
| MLPRegressor                  |               0.65 |      0.74 |  3.80 |       1.63 |
| HuberRegressor                |               0.64 |      0.74 |  3.84 |       0.01 |
| GammaRegressor                |               0.64 |      0.73 |  3.88 |       0.01 |
| LinearSVR                     |               0.62 |      0.72 |  3.96 |       0.01 |
| RidgeCV                       |               0.62 |      0.72 |  3.97 |       0.01 |
| BayesianRidge                 |               0.62 |      0.72 |  3.97 |       0.01 |
| Ridge                         |               0.62 |      0.72 |  3.97 |       0.01 |
| TransformedTargetRegressor    |               0.62 |      0.72 |  3.97 |       0.01 |
| LinearRegression              |               0.62 |      0.72 |  3.97 |       0.01 |
| ElasticNetCV                  |               0.62 |      0.72 |  3.98 |       0.04 |
| LassoCV                       |               0.62 |      0.72 |  3.98 |       0.06 |
| LassoLarsIC                   |               0.62 |      0.72 |  3.98 |       0.01 |
| LassoLarsCV                   |               0.62 |      0.72 |  3.98 |       0.02 |
| Lars                          |               0.61 |      0.72 |  3.99 |       0.01 |
| LarsCV                        |               0.61 |      0.71 |  4.02 |       0.04 |
| SGDRegressor                  |               0.60 |      0.70 |  4.07 |       0.01 |
| TweedieRegressor              |               0.59 |      0.70 |  4.12 |       0.01 |
| GeneralizedLinearRegressor    |               0.59 |      0.70 |  4.12 |       0.01 |
| ElasticNet                    |               0.58 |      0.69 |  4.16 |       0.01 |
| Lasso                         |               0.54 |      0.66 |  4.35 |       0.02 |
| RANSACRegressor               |               0.53 |      0.65 |  4.41 |       0.04 |
| OrthogonalMatchingPursuitCV   |               0.45 |      0.59 |  4.78 |       0.02 |
| PassiveAggressiveRegressor    |               0.37 |      0.54 |  5.09 |       0.01 |
| GaussianProcessRegressor      |               0.23 |      0.43 |  5.65 |       0.03 |
| OrthogonalMatchingPursuit     |               0.16 |      0.38 |  5.89 |       0.01 |
| ExtraTreeRegressor            |               0.08 |      0.32 |  6.17 |       0.01 |
| DummyRegressor                |              -0.38 |     -0.02 |  7.56 |       0.01 |
| LassoLars                     |              -0.38 |     -0.02 |  7.56 |       0.01 |
| KernelRidge                   |             -11.50 |     -8.25 | 22.74 |       0.01 |

lazypredict's People

Contributors

ankur-singh avatar arritmic avatar brendalf avatar cerob avatar dataprofessor avatar dependabot[bot] avatar devdjdjdj avatar felipesassi avatar kristinaray avatar prachir1501 avatar pyup-bot avatar shankarpandala avatar shyambhu-mukherjee avatar shyamcody avatar vidyap-xgboost avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lazypredict's Issues

Tuple model failed to execute

Describe the bug

I am trying to train model, and get the results, but I keep getting tuple model failed to execute.

Expected behavior

It's supposed to be trained, and give me all predictions and info.

Screenshots
Screenshot from 2021-04-09 19-34-20
Screenshot from 2021-04-09 19-34-15

Desktop (please complete the following information):

  • OS: Linux
  • Browser Firefox
  • Version - Latest

Additional context
Add any other context about the problem here.

After pip installing lazypredict, import lazypredict doesn't work. Improvement in Documentation.

Screenshot from 2020-07-19 02-14-43

From the above picture, it is clear that lazypredict is successfully installed, however, if I try to access it, it says No module named lazypredict. Why?

Also README.rst doesn't mention the steps to install this package and directly jumps to USAGE. Does it mean that it should work without pre-installation?

CONTRIBUTING.rst explains how to install using setup.py but doesn't mention that one should install requirements_dev.txt which is essential when working on virtual environments.

Is it fine if I open a PR regarding Documentation?

custom_metric (regression)

Custom_metric is used for results evalutaion only?

Or it's also used in each model as loss for optimization?

Add multiple output capability

Is your feature request related to a problem? Please describe.
I am trying to do a multi class output model. Not working as the code expects a 1D array not 2D.

Describe the solution you'd like
Ideally I'd love to just add as lazypredict arguments an train_Y and test_Y as 2D arrays.

K-fold Cross-validation and built-in Predict function would be great

  • Lazy Predict version: 0.2.9
  • Python version: 3.7 (on google colab)
  • Operating System: Windows 10, and I use python on google colab.

Description

-I wish I could do 5 or 10 fold Cross-validation and get RMSE and STD results in the table.
-Also, I wish there was built in predict function.

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

package not predicting

  • Lazy Predict version: lazypredict-0.2.7
  • Python version: 3.8
  • Operating System: Windows 10 64-bit

Description

I'm trying to make predictions but keep getting the same error both locally and on colab

What I Did


AttributeError                            Traceback (most recent call last)
<ipython-input-22-cb325c4d69cb> in <module>
      1 from lazypredict.Supervised import LazyClassifier
      2 clf = LazyClassifier(verbose=0,ignore_warnings=True, custom_metric=None)
----> 3 models,predictions = clf.fit(X_train, X_test, y_train, y_test)
      4 models

~\AppData\Local\Continuum\anaconda3\lib\site-packages\lazypredict\Supervised.py in fit(self, X_train, X_test, y_train, y_test)
    203             X_test = pd.DataFrame(X_test)
    204 
--> 205         numeric_features = X_train.select_dtypes(
    206             include=['int64', 'float64', 'int32', 'float32']).columns
    207         categorical_features = X_train.select_dtypes(

~\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\sparse\base.py in __getattr__(self, attr)
    689             return self.getnnz()
    690         else:
--> 691             raise AttributeError(attr + " not found")
    692 
    693     def transpose(self, axes=None, copy=False):

AttributeError: select_dtypes not found.

LinearRegressor producing same value for all test data predictions.

Describe the bug
LazyRegressor output (prediction) array produces a single near-constant value for all items within a model. This does not begin to describe the data. Data input is (very loosely) sinusoidal in shape. This occurs with both real and standardized values.

To Reproduce
Steps to reproduce the behaviour:
following the regression example within the documentation

Expected behaviour
Different values within the prediction data frame should not all have the same prediction value.

Desktop (please complete the following information):

  • OS: MAC

Lazypredict package should check for dependencies at installation

Hi,

I wanted to give your package a try, but can't.
A bit of description of my setup:

  • Operating System: Google Colab Notebook (Linux)
  • Python 3.6.9
  • lazypredict==0.2.7
  • scikit-learn==0.24.0

I'm getting an error just by importing your package.

from lazypredict.Supervised import LazyRegressor
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-85-a096f5bd7a1d> in <module>()
----> 1 from lazypredict.Supervised import LazyRegressor

/usr/local/lib/python3.6/dist-packages/lazypredict/Supervised.py in <module>()
     14 from sklearn.preprocessing import StandardScaler, OneHotEncoder
     15 from sklearn.compose import ColumnTransformer
---> 16 from sklearn.utils.testing import all_estimators
     17 from sklearn.base import RegressorMixin
     18 from sklearn.base import ClassifierMixin

ModuleNotFoundError: No module named 'sklearn.utils.testing'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

It seems to be a discrepancy between the version of SciKit-Learn I have and the one that LazyPredict expects, since the architecture of sklearn is different.

Shouldn't you try to make sure that the expected versions of dependency packages are installed ?

Hyperparameter tuning

Is your feature request related to a problem? Please describe.
Recently I saw a review of this library where the user suggested that we should include hyperparameter tuning. I do realize it will increase the train time significantly, but it does sound like a good feature.

Describe the solution you'd like
Optional parameter to tune the hyperparameters of the models while being fitted lazyclassifier or lazyregressor. We definitely need #114 and #65 to be implemented before this to efficiently run the operation. We will need to look into efficient parallel processing and threading also to reduce the overall time.
Additional context
Full review of the library which is motivation for this issue can be seen here.

running problem

Describe the bug
catboost is not installing and it shows sys is not defined
module not found error is coming

Massive memory usage running the LazyClassifier

Describe the bug
Using a dataset with 500k rows and 27 features, I ran into a huge memory issue on iteration 12/30. Screenshot included so you can see how much memory was being used.

Screenshot 2021-02-08 at 13 02 49

Desktop (please complete the following information):

  • OS: OSX Catalina 10.15.5

Additional context
Other packages installed

awswrangler==2.4.0
pandas==1.2.1
numpy==1.20.0
scikit-learn==0.23.1
sqlalchemy==1.3.23
psycopg2-binary==2.8.6
lazypredict==0.2.7
tqdm==4.56.0
xgboost==1.3.3
lightgbm==3.1.1
pytest==6.2.2
imblearn
shap==0.38.1
matplotlib==3.3.4
ipython

Very slow in running a classification algorithm - how to make it faster?

  • Lazy Predict version: lazypredict-0.2.7
  • Python version: 3
  • Operating System: Windows

Description

I am trying to run lazypredict code for a classification use-case and it has been stuck at 3% for over 2 hours. the data size is around 15,000 observations. Any way to speed up the code? Thanks!

What I Did

from lazypredict.Supervised import LazyClassifier
from sklearn.model_selection import train_test_split
import numpy as np

X=data['text']
y=data['category_id']
X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=.3,random_state =1)
clf = LazyClassifier(verbose=0,ignore_warnings=True, custom_metric=None)
models,predictions = clf.fit(np.array(X_train), np.array(X_test), np.array(y_train), np.array(y_test))
models

image

how to get per cases prediction results?

Is your feature request related to a problem? Please describe.
I run the demo code and find the models and predictions are the same.

image

Describe the solution you'd like

How can I get the per case predictions?

Kindest regards,
Jun

ModuleNotFoundError for lazypredict '0.2.7' and sklearn version: '0.24.0'

Describe the bug

when using from lazypredict.Supervised import LazyClassifier in jupyter notebook:

--------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-778-0601eec82da4> in <module>
----> 1 from lazypredict.Supervised import LazyClassifier

~\AppData\Local\Continuum\anaconda3\lib\site-packages\lazypredict\Supervised.py in <module>
     14 from sklearn.preprocessing import StandardScaler, OneHotEncoder
     15 from sklearn.compose import ColumnTransformer
---> 16 from sklearn.utils.testing import all_estimators
     17 from sklearn.base import RegressorMixin
     18 from sklearn.base import ClassifierMixin

ModuleNotFoundError: No module named 'sklearn.utils.testing' 

Versions
sklearn version: '0.24.0'
Jupyter:
jupyter core : 4.6.3
jupyter-notebook : 6.1.1
qtconsole : 4.7.7
ipython : 7.19.0
ipykernel : 5.3.4
jupyter client : 6.1.7
jupyter lab : 2.2.6
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.8
traitlets : 4.3.3

Expected behavior
Expected Lazyclassifier to import, not have modulenotfound error - I have noticed that sklearn.utils.testing doesn't seem have to testing listed for all_estimators, but rather just sklearn.utils

Note: this is my first time opening an issue, if i can be more clear or helpful, please indicate how and i will be obliged to do so.

Option to choose categorical encoder

Is your feature request related to a problem? Please describe.
User should be able to choose categorical encoder apart from the default one-hot encoder

Describe alternatives you've considered
Tried Already encoded data as input. Solves the issue for time being.

incompatiable with Scikit-learn V0.24.2

Hello,

Facing this issue.

lazypredict 0.2.9 requires scikit-learn==0.23.1, but you have scikit-learn 0.24.2 which is incompatible.

lazypredict has to be restricted to scikit older version?

thanks

Wouldn't it be nice if we can visualize the results of `models` instead of just looking at the table?

Since the goal of lazypredict is to run the models quickly and give the results quickly to get insights in a high level, visualizing these results of models or predictions would be much easier to gather insights and draw some conclusion rather than looking at a table.

Or do you think users can use matplotlib or other libraries easily and why to bother writing a function for it?

Any views regarding this?

Custom classifier does not work

When we select the custom classifiers, the corresponding libraries are not selected. Here is where the code has a bug (line 286-297 in the Supervised.py

if self.classifiers == "all": self.classifiers = CLASSIFIERS else: try: temp_list = [] for classifier in self.classifiers: full_name = (classifier.__class__.__name__, classifier) temp_list.append(full_name) self.classifiers = temp_list except Exception as exception: print(exception) print("Invalid Classifier(s)")

The temp_list contains a list of tuples which has the name of the classifier and 'str'. Indeed, it should be the name of the classifier and the corresponding library in the tuples.

ModuleNotFoundError: No module named 'sklearn.utils.testing'

  • Lazy Predict version: '0.2.7'
  • Python version: 3.8.0
  • Sklearn version : 0.21.3 / 0.23.1 / 0.24.1
  • Operating System: Windows 10

Description

I'm trying to Import LazyRegressor from lazypredict.Supervised

But while importing I'm getting an error " ModuleNotFoundError: No module named 'sklearn.utils.testing' ". I try it by installing Sklearn version: 0.21.3 / 0.23.1 / 0.24.1 but the same error is raised everytime ( I did all this in new env )

What I Did

import lazypredict
from lazypredict.Supervised import LazyRegressor

Output :
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-12-340b76a5a8e6> in <module>
      1 import lazypredict
----> 2 from lazypredict.Supervised import LazyRegressor

d:\ds env\python\lib\site-packages\lazypredict\Supervised.py in <module>
     14 from sklearn.preprocessing import StandardScaler, OneHotEncoder
     15 from sklearn.compose import ColumnTransformer
---> 16 from sklearn.utils.testing import all_estimators
     17 from sklearn.base import RegressorMixin
     18 from sklearn.base import ClassifierMixin

ModuleNotFoundError: No module named 'sklearn.utils.testing'

Error - Stacking Regressor

Hi,

I have copied the sample code for the regression comparison (Boston dataset).

It starts running and then stops with the following error message

StackingRegressor model failed to execute
init() missing 1 required positional argument: 'estimators'

Context
I am using sklearn = '0.23.1'
Using jupyter lab
Browser = Firefox

ImportError: cannot import name '_raise_dep_warning_if_not_pytest' from 'sklearn.utils.deprecation' Anaconda3\lib\site-packages\sklearn\utils\deprecation.py)

Describe the bug
I haven't got anything complex... the same code as the tutorial

from lazypredict.Supervised import LazyClassifier, LazyRegressor
from sklearn.model_selection import train_test_split

clf = LazyClassifier(predictions=True)
models, predictions = clf.fit(X_train, x_test, Y_train, y_test)

I'm getting this error message. Could be my config. Please help

ImportError                               Traceback (most recent call last)
<ipython-input-9-f370d18ec53e> in <module>
----> 1 from lazypredict.Supervised import LazyClassifier, LazyRegressor
      2 from sklearn.model_selection import train_test_split
      3 
      4 clf = LazyClassifier(predictions=True)
      5 models, predictions = clf.fit(X_train, x_test, Y_train, y_test)

~\AppData\Roaming\Python\Python38\site-packages\lazypredict\Supervised.py in <module>
     14 from sklearn.preprocessing import StandardScaler, OneHotEncoder, OrdinalEncoder
     15 from sklearn.compose import ColumnTransformer
---> 16 from sklearn.utils.testing import all_estimators
     17 from sklearn.base import RegressorMixin
     18 from sklearn.base import ClassifierMixin

~\Anaconda3\lib\site-packages\sklearn\utils\testing.py in <module>
      5 from . import _testing  # type: ignore
      6 from ..externals._pep562 import Pep562
----> 7 from ..utils.deprecation import _raise_dep_warning_if_not_pytest
      8 
      9 deprecated_path = 'sklearn.utils.testing'

ImportError: cannot import name '_raise_dep_warning_if_not_pytest' from 'sklearn.utils.deprecation' (C:\Users\Anaconda3\lib\site-packages\sklearn\utils\deprecation.py)

Python version : 3.7.4
pip check lazypredict
instapy 0.6.10 has requirement jsonschema<3,>=2.6.0, but you have jsonschema 3.2.0.
clarifai 2.6.2 has requirement configparser<4,>=3.5, but you have configparser 5.0.0.
clarifai 2.6.2 has requirement jsonschema<3,>=2.5, but you have jsonschema 3.2.0.

Dependency list needs to be expanded

Describe the bug
The current dependencies mentioned are not enough. User has to manually download multiple other libraries such as tqdm,xgboost, lightgbm, pytest. So please add these to the dependency/ requirements so that it automatically downloads these files when lazypredict is installed in an environment.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new python environment.
  2. install lazypredict.
  3. try and run lazypredict from python using the following lines:

import lazypredict
from lazypredict.Supervised import LazyClassifier
Traceback (most recent call last):
File "", line 1, in
File "/home/shyambhu.mukherjee/spacy_lazypredict/new_app/lib/python3.6/site-packages/lazypredict/Supervised.py", line 8, in
from tqdm import tqdm
ModuleNotFoundError: No module named 'tqdm'

  1. See that module not found error will come for tqdm,xgboost, lightgbm and pytest.

Expected behavior
While pip installing lazypredict, it should download all the things.

Desktop:

  • OS: ubuntu 18.04 bionic
  • Version: lazypredict==0.2.7
    python==3.6.9.

ImportError: cannot import name 'values_from_object' from 'pandas._libs.lib'

  • Lazy Predict version:
  • Python version:
  • Operating System:

Description

Im running libeary on google colab

What I Did

clf = LazyClassifier(verbose=0, ignore_warnings=True, custom_metric=None)
models, predictions = clf.fit(X_train, X_test, y_train, y_test)
models

Output =>
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/pyforest/__init__.py in <module>()
      1 clf = LazyClassifier(verbose=0, ignore_warnings=True, custom_metric=None)
----> 2 models, predictions = clf.fit(X_train, X_test, y_train, y_test)
      3 models

6 frames
/usr/local/lib/python3.7/dist-packages/pandas/core/computation/expressions.py in <module>()
     13 from pandas._config import get_option
     14 
---> 15 from pandas._libs.lib import values_from_object
     16 
     17 from pandas.core.dtypes.generic import ABCDataFrame

ImportError: cannot import name 'values_from_object' from 'pandas._libs.lib' (/usr/local/lib/python3.7/dist-packages/pandas/_libs/lib.cpython-37m-x86_64-linux-gnu.so)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

custom_metric parameter returns error when set for LazyClassifier

Description:
Setting custom_metric of LazyClassifier returns a ValueError: arrays must all be same length.

Steps to reproduce the behavior:
Set the value of custom_metric in LazyClassifer to sklearn.metrics log_loss

Expected behavior:
Log Loss metric column should be returned in the scores dataframe

Screenshot:
image

Desktop:

  • OS: Windows 10 Pro
  • Browser: Chrome
  • Version: -NA-

Additional Content:
-> Error points to TIME list when constructing the scores dataframe
-> Also the issue happens irrespective of verbose value i.e. 0 or 1

How I can use trained Regression model on new input feature

Hii
I'm using LazyPredict to get performance of Regression models on a dataset (with LazyRegressor), and finally I am getting the performance table and prediction values from this

regr=LazyRegressor(verbose=0,predictions=True)   
models_r,predictions_r=regr.fit(X_train, X_test, Y_train, Y_test)

But now I want to know the prediction values on new input features.

So, how I can use this model_r to get the prediction table? or is there other way to get it ?

Help. How will I solve this problem?

AdaBoostRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
BaggingRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
BayesianRidge model failed to execute
all features must be in [0, 83] or [-84, 0]
DecisionTreeRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
DummyRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
ElasticNet model failed to execute
all features must be in [0, 83] or [-84, 0]
ElasticNetCV model failed to execute
all features must be in [0, 83] or [-84, 0]
ExtraTreeRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
ExtraTreesRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
GammaRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
GaussianProcessRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
GeneralizedLinearRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
GradientBoostingRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
HistGradientBoostingRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
HuberRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
KNeighborsRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
KernelRidge model failed to execute
all features must be in [0, 83] or [-84, 0]
Lars model failed to execute
all features must be in [0, 83] or [-84, 0]
LarsCV model failed to execute
all features must be in [0, 83] or [-84, 0]
Lasso model failed to execute
all features must be in [0, 83] or [-84, 0]
LassoCV model failed to execute
all features must be in [0, 83] or [-84, 0]
LassoLars model failed to execute
all features must be in [0, 83] or [-84, 0]
LassoLarsCV model failed to execute
all features must be in [0, 83] or [-84, 0]
LassoLarsIC model failed to execute
all features must be in [0, 83] or [-84, 0]
LinearRegression model failed to execute
all features must be in [0, 83] or [-84, 0]
LinearSVR model failed to execute
all features must be in [0, 83] or [-84, 0]
MLPRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
NuSVR model failed to execute
all features must be in [0, 83] or [-84, 0]
OrthogonalMatchingPursuit model failed to execute
all features must be in [0, 83] or [-84, 0]
OrthogonalMatchingPursuitCV model failed to execute
all features must be in [0, 83] or [-84, 0]
PassiveAggressiveRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
PoissonRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
RANSACRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
RandomForestRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
Ridge model failed to execute
all features must be in [0, 83] or [-84, 0]
RidgeCV model failed to execute
all features must be in [0, 83] or [-84, 0]
SGDRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
SVR model failed to execute
all features must be in [0, 83] or [-84, 0]
StackingRegressor model failed to execute
init() missing 1 required positional argument: 'estimators'
TransformedTargetRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
TweedieRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
XGBRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
LGBMRegressor model failed to execute
all features must be in [0, 83] or [-84, 0]
100%|██████████| 43/43 [00:00<00:00, 1954.43it/s]
Empty DataFrame
Columns: [R-Squared, RMSE, Time Taken]
Index: []

feature not accepted - sparse matric

  • Lazy Predict version: latest
  • Python version:
  • Operating System:

Description

Describe what you were trying to get done.
I have one feature. This feature is a
<1044374x15537 sparse matrix of type '<class 'numpy.float64'>' with 10514625 stored elements in Compressed Sparse Row format>
I'm guessing that's where the problem comes from, I'm getting :

`~\AppData\Roaming\Python\Python38\site-packages\lazypredict\Supervised.py in fit(self, X_train, X_test, y_train, y_test)
269 X_test = pd.DataFrame(X_test)
270
--> 271 numeric_features = X_train.select_dtypes(include=[np.number]).columns
272 categorical_features = X_train.select_dtypes(include=["object"]).columns
273

~\AppData\Roaming\Python\Python38\site-packages\scipy\sparse\base.py in getattr(self, attr)
685 return self.getnnz()
686 else:
--> 687 raise AttributeError(attr + " not found")
688
689 def transpose(self, axes=None, copy=False):

AttributeError: select_dtypes not found`

Add a custom metric example for the classifier or regressor

Is your feature request related to a problem? Please describe.
I noticed you used the weighted F1 score as the default metric for F1.
Sometimes, you don't want to just use the weighted version. There is no example of how should the users add their customized scorer function.

Describe the solution you'd like
Can you provide an example of how to add a custom scorer to the classifier or the regressor for using lazypredict?

Get model object

I couldn't find any methods to return the model objects that are trained.

Does lazypredict allow that? If yes, how ?

scipy version

ERROR: Could not find a version that satisfies the requirement scipy==1.6.0 (from lazypredict) (from versions: 0.8.0, 0.9.0, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.12.1, 0.13.0, 0.13.1, 0.13.2, 0.13.3, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.16.0, 0.16.1, 0.17.0, 0.17.1, 0.18.0rc2, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 1.0.0b1, 1.0.0rc1, 1.0.0rc2, 1.0.0, 1.0.1, 1.1.0rc1, 1.1.0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.4.0rc1, 1.4.0rc2, 1.4.0, 1.4.1, 1.5.0rc1, 1.5.0rc2, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4)
ERROR: No matching distribution found for scipy==1.6.0 (from lazypredict)

Include Adjusted R-square metric for regression

Is your feature request related to a problem? Please describe.
R-square is not a correct metric when we have multiple features

Describe the solution you'd like
Adjusted R-square metric needs to be included for Regression

lazy regressor not working

Describe the bug
the lazy regressor is not working

To Reproduce
Steps to reproduce the behavior:

  1. run the lazy regressor code
    2.you'll see there is no output displayed only the learning rates are available
  2. no r-square value displayed
  3. there is a problem in the stackregressor
  4. see an error

ran on google colab

image

Custom classifiers issue

Hi, I am able to call LazyClassifier and everything displays as expected.

However, when passing in a list to "classifiers" for specific algorithms, they have been showing up as either "ABCMeta" or "Type".
I've attached an example passing in two classifiers but this also affects larger lists.
image
image
image

ModuleNotFoundError: No module named 'xgboost'

Capture
@shankarpandala : i really liked this library and will help in future, reporting a bug / issue

Describe the bug
I have literally copy pasted the entire code in Jupyter notebook. I am getting an error

ModuleNotFoundError: No module named 'xgboost'

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
I am attaching screenshot for your reference

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome

AttributeError: module 'lightgbm' has no attribute 'LGBMRegressor'


AttributeError Traceback (most recent call last)
in
----> 1 from lazypredict.Supervised import LazyClassifier, LazyRegressor
2 from sklearn.model_selection import train_test_split
3 from sklearn import datasets
4 from lightgbm import *

~/opt/anaconda3/lib/python3.7/site-packages/lazypredict/Supervised.py in
77
78 REGRESSORS.append(('XGBRegressor', xgboost.XGBRegressor))
---> 79 REGRESSORS.append(('LGBMRegressor',lightgbm.LGBMRegressor))
80 # REGRESSORS.append(('CatBoostRegressor',catboost.CatBoostRegressor))
81

AttributeError: module 'lightgbm' has no attribute 'LGBMRegressor'


MacOs 10.15.7
lightgbm 3.1.1
lazypredict 0.2.7

it show this error why ?

Intall ERROR: Cannot uninstall 'PyYAML'.

Describe the bug
A clear and concise description of what the bug is.

Thanks for the great work.

I have the following errors when installing the latest lazypredict.

ERROR: astroid 2.3.1 requires typed-ast<1.5,>=1.4.0; implementation_name == "cpython" and python_version < "3.8", which is not installed.
ERROR: auto-sklearn 0.12.3 has requirement scikit-learn<0.25.0,>=0.24.0, but you'll have scikit-learn 0.23.1 which is incompatible.
ERROR: astroid 2.3.1 has requirement six==1.12, but you'll have six 1.15.0 which is incompatible.
Installing collected packages: scikit-learn, pytest, six, xgboost, pandas, tqdm, click, lightgbm, PyYAML, lazypredict
  Found existing installation: scikit-learn 0.24.1
    Uninstalling scikit-learn-0.24.1:
      Successfully uninstalled scikit-learn-0.24.1
  Found existing installation: pytest 5.2.1
    Uninstalling pytest-5.2.1:
      Successfully uninstalled pytest-5.2.1
  Found existing installation: six 1.12.0
    Uninstalling six-1.12.0:
      Successfully uninstalled six-1.12.0
  Found existing installation: pandas 1.2.2
    Uninstalling pandas-1.2.2:
      Successfully uninstalled pandas-1.2.2
  Found existing installation: tqdm 4.36.1
    Uninstalling tqdm-4.36.1:
      Successfully uninstalled tqdm-4.36.1
  Found existing installation: Click 7.0
    Uninstalling Click-7.0:
      Successfully uninstalled Click-7.0
  Found existing installation: PyYAML 5.1.2
ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

To Reproduce
Steps to reproduce the behavior:

  1. pip install lazypredict

Screenshots

image

image

Desktop (please complete the following information):

image

Any help will be highly appreciated.

Best regards,
Jun

Taking too much time to run .

  • Lazy Predict version:
  • Python version:
  • Operating System:

Description

I tried to run lazypredict regressor on a black friday sales train dataset n it gets stuck on 60 %-63% . dataset has 55,000 rows.

What I Did


 60%|█████████████████████████████████████████████████▌                                | 26/43 [33:11<04:11, 14.82s/it]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.