模型越复杂越容易惰性
Hey, hope you are having a wonderful day!
嘿,希望您今天过得愉快!
Whenever I work on a new ML project. These lines always pop up in my mind every time
每当我从事新的ML项目时。 这些线每次都会在我的脑海中弹出
“I need to fit the data for every model then apply metrics to check which model has better accuracy for the available dataset ,then choose best model and also this process is time-consuming and even it might not be that much effective too“
“我需要为每个模型拟合数据,然后应用度量标准来检查哪个模型对可用数据集具有更好的准确性,然后选择最佳模型,而且此过程非常耗时,甚至可能效果也不那么好”
For this problem, I got a simple solution when surfing through python org, which is a small python library by name “lazypredict” and it does wonders
对于这个问题,我在通过python org进行浏览时得到了一个简单的解决方案,这是一个名为“ lazypredict”的小型python库,它的确令人惊讶
Let me tell you how it works:-
让我告诉你它是如何工作的:
安装库 (Install the library)
pip install lazypredict
注意 (Note)
- lazypredict only works for python version≥3.6 lazypredict仅适用于Python版本≥3.6
- It's built on top of various other libraries so if you don't have those libraries in the system, python will throw ModuleError so interpret the error properly and install the required libraries. 它建立在其他各种库的基础上,因此,如果系统中没有这些库,则python会抛出ModuleError,从而正确解释错误并安装所需的库。
lazypredict comes only for supervised learning (Classification and Regression)
lazypredict仅用于监督学习(分类和回归)
I will be using jupyter notebook in this article
我将在本文中使用Jupyter Notebook
码 (Code)
# import necessary modules
import warnings
warnings.filterwarnings('ignore')
import time
from sklearn.datasets import load_iris,fetch_california_housing
from sklearn.model_selection import train_test_split
from lazypredict.Supervised import LazyClassifier,LazyRegressor
- warnings: Package to handle warnings and ‘ignore’ is used when we need to filter out all the warnings 警告:处理警告和“忽略”的包在我们需要过滤掉所有警告时使用
- time: Package to handle time manipulation time:处理时间的软件包
- sklearn.datasets: Package to load datasets, today we gonna use the classic datasets which everyone works on it that are load_iris() for classification problem and fetch_california_housing() for a regression problem