📜  lazypredict (1)

📅  最后修改于: 2023-12-03 15:02:39.847000             🧑  作者: Mango

Introduction to Lazypredict

Lazypredict is a Python module that helps data scientists by automating the model selection and optimization process. It is designed to make it easier to choose and evaluate machine learning models for regression and classification tasks.

Features

Some of the features of Lazypredict are:

  • Automatic model training and evaluation
  • Support for various regression and classification models
  • Easy to use API
Installation

To install Lazypredict, you can simply use pip:

pip install lazypredict
Usage

To use Lazypredict, you can create an instance of the LazyRegressor or LazyClassifier class and fit it to your data:

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

X, y = load_boston(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)

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

This will train and test various models and return the results in a DataFrame:

>>> models
                               R-Squared  RMSE  Time Taken
Model                                                     
SVR                                -0.097 33.34        0.18
NuSVR                              -0.063 32.97        0.19
...
GradientBoostingRegressor           0.745  4.79        0.49
RandomForestRegressor               0.737  4.89        1.46
XGBRegressor                        0.735  4.92        0.62

>>> predictions
    AdaBoostRegressor  BaggingRegressor  BayesianRidge  DecisionTreeRegressor  \
0               28.66             27.34          28.59                  28.86   
1               34.39             32.92          34.30                  35.09   
...
Conclusion

Lazypredict is a great tool for data scientists who want to quickly evaluate multiple models and find the best one for their task. With its easy-to-use API and support for various regression and classification models, it can help you save time and improve your model performance.